public static IConfigurationBuilder AddDnsFile(this IConfigurationBuilder builder, IFileProvider provider, string path, string basePath, bool optional, bool reloadOnChange)
        {
            Check.NotNull(builder, "builder");
            Check.CheckCondition(() => string.IsNullOrEmpty(path), "path");
            path = EnvironmentHelper.GetEnvironmentVariable(path);
            if (provider == null && Path.IsPathRooted(path))
            {
                provider = new PhysicalFileProvider(Path.GetDirectoryName(path));
                path     = Path.GetFileName(path);
            }

            var source = new EventBusConfigurationSource
            {
                FileProvider   = provider,
                Path           = path,
                Optional       = optional,
                ReloadOnChange = reloadOnChange
            };

            builder.Add(source);
            if (!string.IsNullOrEmpty(basePath))
            {
                builder.SetBasePath(basePath);
            }
            AppConfig.Configuration = builder.Build();
            AppConfig.DnsOption     = AppConfig.Configuration.Get <DnsOption>();
            return(builder);
        }
예제 #2
0
 public EventBusConfigurationProvider(EventBusConfigurationSource source) : base(source)
 {
 }