About configuration center of Apollo

A comparison among different configuration management tools

Use of Apollo configuration management portal: Installation manual on project Wikihtml

  1. Download source from github, either git clone or download zip
  2. in /script/dockerquickstart folder, check docker compose ports availability
  3. docker-compose up
  4. 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 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();

Verification works:

. Get config from apollojson

var configValue=Configuration["apollokey"];
相關文章
相關標籤/搜索