Documentation
¶
Index ¶
- Constants
- func RedactSecrets(schema Schema, data map[string]any) map[string]any
- func StrictMode() bool
- func ValidateConfigKeys(providerName, fileName, embeddedContent, confDir string) error
- func ValidateSchema(schema Schema, data map[string]any) error
- type ConfServiceProvider
- func (i *ConfServiceProvider) Boot(ctx context.Context) error
- func (i *ConfServiceProvider) Conf() map[string]string
- func (i *ConfServiceProvider) Description() string
- func (i *ConfServiceProvider) Register(ctx context.Context) error
- func (i *ConfServiceProvider) SetApplication(app foundation.Application)
- type Configure
- type Schema
- type SchemaField
Constants ¶
View Source
const (
ConfigChangeEvent = "config_change"
)
Variables ¶
This section is empty.
Functions ¶
func RedactSecrets ¶ added in v1.1.0
RedactSecrets 按 Schema 中标记 Secret 的字段,将 map 中对应值替换为 "***"。 用于日志输出,避免泄露密钥;返回拷贝后的 map(嵌套 map 会递归拷贝路径上的节点)。
func StrictMode ¶ added in v1.1.0
func StrictMode() bool
StrictMode 是否启用配置严格校验(缺键启动失败)。 环境变量:HARBOR_CONF_STRICT=1|true|yes|on
func ValidateConfigKeys ¶
ValidateConfigKeys compares keys in the embedded default YAML with the on-disk config file. For any key present in embedded but missing on disk:
- default: yellow warning only
- HARBOR_CONF_STRICT=1/true: return error (启动失败)
Parse failures always return error.
Types ¶
type ConfServiceProvider ¶
type ConfServiceProvider struct {
// contains filtered or unexported fields
}
func (*ConfServiceProvider) Boot ¶
func (i *ConfServiceProvider) Boot(ctx context.Context) error
func (*ConfServiceProvider) Conf ¶
func (i *ConfServiceProvider) Conf() map[string]string
func (*ConfServiceProvider) Description ¶
func (i *ConfServiceProvider) Description() string
func (*ConfServiceProvider) Register ¶
func (i *ConfServiceProvider) Register(ctx context.Context) error
func (*ConfServiceProvider) SetApplication ¶ added in v1.1.0
func (i *ConfServiceProvider) SetApplication(app foundation.Application)
type Configure ¶
type Configure struct {
// contains filtered or unexported fields
}
func NewConfigure ¶
func NewConfigure(app foundation.Application, bus EventBus.Bus) (*Configure, error)
type Schema ¶ added in v1.1.0
type Schema struct {
Provider string
File string
Fields []SchemaField
}
Schema 配置 Schema。
Source Files
¶
- conf_service_provider.go
- event.go
- load.go
- schema.go
- secret.go
- validate.go
Click to show internal directories.
Click to hide internal directories.