config

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAbsPath added in v1.0.0

func GetAbsPath(paths ...string) string

GetAbsPath returns the absolute path by joining the given paths with the project root directory

Types

type AccountConfig added in v1.0.0

type AccountConfig struct {
	AdminEmail    string      `mapstructure:"admin_email"`
	AdminPassword SecretValue `mapstructure:"admin_password"`
}

type DecisionMakerConfig added in v1.0.0

type DecisionMakerConfig struct {
	Server  ServerConfig  `mapstructure:"server"`
	Logging LoggingConfig `mapstructure:"logging"`
	Token   TokenConfig   `mapstructure:"token"`
	MTLS    MTLSConfig    `mapstructure:"mtls"`
}

func InitDMConfig added in v1.0.0

func InitDMConfig(configName string, configPath string) (DecisionMakerConfig, error)

type K8SConfig added in v1.0.0

type K8SConfig struct {
	KubeConfigPath string `mapstructure:"kube_config_path"`
	IsInCluster    bool   `mapstructure:"in_cluster"`
}

type KeyConfig added in v1.0.0

type KeyConfig struct {
	RsaPrivateKeyPem SecretValue `mapstructure:"rsa_private_key_pem"`
	DMPublicKeyPem   SecretValue `mapstructure:"dm_public_key_pem"`
	ClientID         string      `mapstructure:"client_id"`
}

type LoggingConfig

type LoggingConfig struct {
	Level    string `mapstructure:"level"`
	Console  bool   `mapstructure:"console"`
	FilePath string `mapstructure:"file_path"`
}

type MTLSConfig added in v1.3.0

type MTLSConfig struct {
	Enable     bool        `mapstructure:"enable"`
	ServerName string      `mapstructure:"server_name"`
	CertPem    SecretValue `mapstructure:"cert_pem"`
	KeyPem     SecretValue `mapstructure:"key_pem"`
	CAPem      SecretValue `mapstructure:"ca_pem"`
}

MTLSConfig holds the mutual TLS configuration used for Manager ↔ Decision Maker communication. CertPem and KeyPem are the service's own certificate/key pair signed by the private CA. CAPem is the private CA certificate used to verify the peer's certificate.

type ManageConfig added in v1.0.0

type ManageConfig struct {
	Server  ServerConfig  `mapstructure:"server"`
	Logging LoggingConfig `mapstructure:"logging"`
	MongoDB MongoDBConfig `mapstructure:"mongodb"`
	Key     KeyConfig     `mapstructure:"key"`
	Account AccountConfig `mapstructure:"account"`
	K8S     K8SConfig     `mapstructure:"k8s"`
	MTLS    MTLSConfig    `mapstructure:"mtls"`
}

func GetDMConfig added in v1.0.0

func GetDMConfig() *ManageConfig

func GetManagerConfig added in v1.0.0

func GetManagerConfig() *ManageConfig

func InitManagerConfig added in v1.0.0

func InitManagerConfig(configName string, configPath string) (ManageConfig, error)

type MongoDBConfig added in v1.0.0

type MongoDBConfig struct {
	Database    string      `mapstructure:"database"`
	CAPem       SecretValue `mapstructure:"ca_pem"`
	CAPemEnable bool        `mapstructure:"ca_pem_enable"`
	User        string      `mapstructure:"user"`
	Password    SecretValue `mapstructure:"password"`
	Port        string      `mapstructure:"port"`
	Host        string      `mapstructure:"host"`
	Options     string      `mapstructure:"options"`
}

func (MongoDBConfig) GetURI added in v1.0.0

func (mc MongoDBConfig) GetURI() string

type SecretValue added in v1.0.0

type SecretValue string

func (SecretValue) String added in v1.0.0

func (s SecretValue) String() string

func (SecretValue) Value added in v1.0.0

func (s SecretValue) Value() string

type ServerConfig

type ServerConfig struct {
	Host string `mapstructure:"host"`
}

type TokenConfig added in v1.0.0

type TokenConfig struct {
	RsaPrivateKeyPem SecretValue `mapstructure:"rsa_private_key_pem"`
	TokenDurationHr  int         `mapstructure:"token_duration_hr"` // in hours
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL