A comparison among different configuration management tools
Use of Apollo configuration management portal:- 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
Client usage in .net core
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() .Build();
Verification works:
. Get config from apollo
var configValue=Configuration["apollokey"];