A comparison among different configuration management tools
Use of Apollo configuration management portal: Installation manual on project Wikihtml
Install package on nugetgit
Install-Package Com.Ctrip.Framework.Apollo.Configuration
appsettings.jsongithub
{ "apollo": { "AppId": "dynamicforms-service", // This key comes from UI, create an application on UI and specify unique key. "MetaServer": "http://192.168.1.7:8081" } }
program.csdocker
public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .ConfigureAppConfiguration((hostingContext, builder) => { builder .AddApollo(builder.Build().GetSection("apollo")) .AddDefault() .AddNamespace("Common");//Apollo中NameSpace的名称,加上这个使配置在不一样服务公用 }) .UseStartup<Startup>() .Build();
. Get config from apollojson
var configValue=Configuration["apollokey"];