A comparison among different configuration management tools
Use of Apollo configuration management portal: Installation manual on project Wiki
- Download source from github, either git clone or download zip
- in /script/dockerquickstart folder, check docker compose ports availability
- docker-compose up
- visit the mapped portal on server: 192.168.1.7:8070, login with user:apollo pass: admin Portal manual
Client usage in .net core UI Usage and Program.cs Startup.cs
Install package on nuget
Install-Package Com.Ctrip.Framework.Apollo.Configuration
appsettings.json
{
"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.cs
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();
Verification works:
. Get config from apollo
var configValue=Configuration["apollokey"];