Table of Contents

Class CfgSourceLevels

Namespace
Apq.Cfg
Assembly
Apq.Cfg.dll

配置源默认层级常量

public static class CfgSourceLevels
Inheritance
CfgSourceLevels
Inherited Members

Remarks

层级规划原则:数值越大优先级越高,高层级覆盖低层级

| 层级范围 | 用途 | 配置源 | |----------|------|--------| | 0 | 基础配置文件 | Json, Ini, Xml, Yaml, Toml | | 100 | 远程存储 | Redis, Database | | 200 | 配置中心 | Consul, Etcd, Nacos, Apollo, Zookeeper | | 300 | 密钥管理 | Vault | | 400 | 环境相关 | .env, EnvironmentVariables(最高优先级覆盖) |

Fields

Apollo

Apollo 配置中心默认层级 (200)

public const int Apollo = 200

Field Value

int

Remarks

配置中心,优先级高于远程存储

Consul

Consul 配置中心默认层级 (200)

public const int Consul = 200

Field Value

int

Remarks

配置中心,优先级高于远程存储

Database

数据库配置源默认层级 (100)

public const int Database = 100

Field Value

int

Remarks

远程存储配置源,优先级高于本地文件

Env

.env 文件默认层级 (400)

public const int Env = 400

Field Value

int

Remarks

.env 文件用于环境特定配置,与环境变量同级。 当 setEnvironmentVariables=true 时,.env 内容会写入系统环境变量。

EnvironmentVariables

环境变量默认层级 (400)

public const int EnvironmentVariables = 400

Field Value

int

Remarks

环境变量具有最高优先级,用于运行时覆盖

Etcd

Etcd 配置中心默认层级 (200)

public const int Etcd = 200

Field Value

int

Remarks

配置中心,优先级高于远程存储

Hcl

HCL 文件默认层级 (0)

public const int Hcl = 0

Field Value

int

Remarks

基础配置文件,HashiCorp Configuration Language

Ini

INI 文件默认层级 (0)

public const int Ini = 0

Field Value

int

Remarks

基础配置文件

Json

JSON 文件默认层级 (0)

public const int Json = 0

Field Value

int

Remarks

基础配置文件,通常作为应用程序的默认配置

Nacos

Nacos 配置中心默认层级 (200)

public const int Nacos = 200

Field Value

int

Remarks

配置中心,优先级高于远程存储

Properties

Properties 文件默认层级 (0)

public const int Properties = 0

Field Value

int

Remarks

基础配置文件,Java Properties 格式

Redis

Redis 配置源默认层级 (100)

public const int Redis = 100

Field Value

int

Remarks

远程存储配置源,优先级高于本地文件

Toml

TOML 文件默认层级 (0)

public const int Toml = 0

Field Value

int

Remarks

基础配置文件

Vault

HashiCorp Vault 密钥管理默认层级 (300)

public const int Vault = 300

Field Value

int

Remarks

密钥管理,优先级高于配置中心,用于敏感配置

Xml

XML 文件默认层级 (0)

public const int Xml = 0

Field Value

int

Remarks

基础配置文件

Yaml

YAML 文件默认层级 (0)

public const int Yaml = 0

Field Value

int

Remarks

基础配置文件

Zookeeper

Zookeeper 配置中心默认层级 (200)

public const int Zookeeper = 200

Field Value

int

Remarks

配置中心,优先级高于远程存储