/// <summary> /// Generates an environment variable map of the options. /// </summary> /// <remarks> /// Each key is the variable name; each value is the variable value. /// </remarks> public static IDictionary <string, string> ToEnvironmentConfiguration(this RootOptions options, bool useDotnetMonitorPrefix = false) { Dictionary <string, string> variables = new(StringComparer.OrdinalIgnoreCase); MapObject(options, useDotnetMonitorPrefix ? EnvironmentVariablePrefix : string.Empty, KeySegmentSeparator, variables); return(variables); }
/// <summary> /// Generates a key-per-file map of the options. /// </summary> /// <remarks> /// Each key is the file name; each value is the file content. /// </remarks> public static IDictionary <string, string> ToKeyPerFileConfiguration(this RootOptions options) { Dictionary <string, string> variables = new(StringComparer.OrdinalIgnoreCase); MapObject(options, string.Empty, KeySegmentSeparator, variables); return(variables); }
/// <summary> /// Generates a map of options that can be passed directly to configuration via an in-memory collection. /// </summary> /// <remarks> /// Each key is the configuration path; each value is the configuration path value. /// </remarks> public static IDictionary <string, string> ToConfigurationValues(this RootOptions options) { Dictionary <string, string> variables = new(StringComparer.OrdinalIgnoreCase); MapObject(options, string.Empty, ConfigurationPath.KeyDelimiter, variables); return(variables); }