Skip to content

[API Proposal]: YAML configuration provider #109199

Open
@stasberkov

Description

@stasberkov

Background and motivation

Currently, ASP.NET Core supports configuration providers for JSON, XML, and INI files. However, YAML is a popular configuration format due to its readability and support for complex data structures. Adding a YAML configuration provider would enhance the flexibility and usability of ASP.NET Core applications, especially for developers who prefer or require YAML for their configuration needs.

Benefits:

  • Increased flexibility in configuration file formats.
  • Improved readability and maintainability of configuration files for developers who prefer YAML.
  • Enhanced support for complex configuration scenarios.

YAML is widely used in various applications and tools, such as Kubernetes and Ansible, making it a valuable addition to the ASP.NET Core configuration system. By supporting YAML, ASP.NET Core can better align with the preferences and needs of a broader developer community.

API Proposal

builder.Configuration
    .AddYamlFile("appsettings.yaml", optional: false, reloadOnChange: true)
    .AddYamlFile($"appsettings.{builder.Environment.EnvironmentName}.yaml", optional: true, reloadOnChange: true);

API Usage

builder.Configuration
    .AddYamlFile("appsettings.yaml", optional: false, reloadOnChange: true)
    .AddYamlFile($"appsettings.{builder.Environment.EnvironmentName}.yaml", optional: true, reloadOnChange: true);

Alternative Designs

No response

Risks

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions