Skip to content

Latest commit

 

History

History
75 lines (51 loc) · 1.37 KB

File metadata and controls

75 lines (51 loc) · 1.37 KB

🎯 Kat.Configuration.Yaml

Read YAML files in your .NET apps - super easy!

🤔 What is this?

This library helps you read settings from YAML files in your .NET applications. YAML is like JSON but easier to read and write!

📦 Installation

dotnet add package Kat.Configuration.Yaml

🚀 Quick Start

1. Create a appsettings.yaml file:

App:
  Name: MyAwesomeApp
  Version: 1.0.0
Database:
  Host: localhost
  Port: 5432

2. Add it to your app:

using Microsoft.Extensions.Configuration;

var config = new ConfigurationBuilder()
    .AddYamlFile("appsettings.yaml")
    .Build();

// Read your settings
var appName = config["App:Name"];        // "MyAwesomeApp"
var dbHost = config["Database:Host"];    // "localhost"

🎨 Features

  • ✅ Simple to use
  • ✅ Works with .NET 5, 6, 7, 8, 9 and .NET Standard 2.0

💡 More Examples

Optional file (won't crash if missing):

.AddYamlFile("appsettings.yaml", optional: true)

Reload when file changes:

.AddYamlFile("appsettings.yaml", optional: false, reloadOnChange: true)

Read from a Stream:

using var stream = File.OpenRead("config.yaml");
.AddYamlStream(stream)

🤝 Contributing

Found a bug? Want to help? Pull requests are welcome!

📄 License

Apache License 2.0


Made with ❤️ for the .NET community