Doo.Config
0.1.4-alpha
This is a prerelease version of Doo.Config.
dotnet add package Doo.Config --version 0.1.4-alpha
NuGet\Install-Package Doo.Config -Version 0.1.4-alpha
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Doo.Config" Version="0.1.4-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Doo.Config --version 0.1.4-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Doo.Config, 0.1.4-alpha"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Doo.Config as a Cake Addin #addin nuget:?package=Doo.Config&version=0.1.4-alpha&prerelease // Install Doo.Config as a Cake Tool #tool nuget:?package=Doo.Config&version=0.1.4-alpha&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Doo.Config 配置中心
提供统一配置,所有节点均从该节点读取配置
同时可以从该节点去同步各个节点的配置、重启各个节点、查看各个节点的运行情况
提供单机模式和中心节点模式
单机模式
由应用直接读取配置、保存日志。此模式不支持订阅事件,当然单节点也没有跨节点同步事件的需求。中心节点模式
由应用连接到中心节点读取配置,上传日志,订阅事件。
单机模式
using Doo.Config;
var cfg=new LocalConfig("config");//设置配置文件路径,未设置时,默认为app
//查找以根目录为基准,后缀为.json的配置文件
string port = cfg.AppConfig["port"];
//从配置文件中查找port的变量值。优先级为*.publish.json>*.local.json>*.json
支持常量
{
"{var}": {
"IP": "222.111.333.22",
"PORT": "6379"
},
"redis:compute": "{IP}:{PORT}",
"redis:datasource": "{IP}:6380",
"redis:store": "{IP}:6381"
名为{var}的节配置了要替换的常量,加载配置文件时就执行了替换操作。
从嵌入的资源读取
开发时,有时需要设置一系列的默认配置,这些配置可以被实际使用时覆盖。
可以在项目的根目录下放置配置文件,如app.json,设置生成方式为嵌入的资源,此时编译后该json就会成为dll中的嵌入资源
在读取时,使用new LocalConfig("app"){FindInAsm=true}就可以以嵌入配置为默认配置了。
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.1
- Doo.Logging (>= 0.0.2-alpha)
- Microsoft.AspNetCore.Http.Abstractions (>= 2.2.0)
- Microsoft.AspNetCore.SignalR.Client (>= 1.1.0)
- Microsoft.Extensions.Configuration (>= 3.0.0)
- Microsoft.Extensions.Configuration.Json (>= 3.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
0.1.4-alpha | 389 | 10/19/2019 | |
0.1.3-alpha | 344 | 10/19/2019 | |
0.1.2-alpha | 358 | 10/6/2019 | |
0.1.1-alpha | 344 | 10/5/2019 | |
0.1.0 | 690 | 10/4/2019 |
Doo配置节点
可单机可中心
使用说明见ReadMe.md