About configuration center of Apollo

A comparison among different configuration management tools
325785-20190221155454149-1803079203.png
Use of Apollo configuration management portal: Installation manual on project Wiki

  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 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"];

转载于:https://www.cnblogs.com/hualiu0/p/10413122.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值