config

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigDirEnv = "HERMOD_CONFIG_DIR"

ConfigDirEnv overrides the directory Hermod reads and writes its own config from (db_config.yaml and friends).

Without it the location is hard-wired to ~/.hermod, so running a development or test instance silently overwrites the configuration of whatever other instance the developer is using. Pointing this at a scratch directory keeps the two apart — see scripts/dev.sh.

Variables

This section is empty.

Functions

func BuildUI

func BuildUI() error

BuildUI builds the React UI and copies the assets to the internal/api/static directory.

func CanBuildUI

func CanBuildUI() bool

CanBuildUI checks if the source code for the UI is available to be built.

func EnsureConfigDir

func EnsureConfigDir() error

func GetConfigDir

func GetConfigDir() string

func GetConfigPath

func GetConfigPath(filename string) string

func IsDBConfigured

func IsDBConfigured() bool

func IsUIBuilt

func IsUIBuilt() bool

IsUIBuilt checks if the UI assets have been built and copied to the static directory.

func SaveConfig

func SaveConfig(path string, cfg *Config) error

func SaveDBConfig

func SaveDBConfig(cfg *DBConfig) error

func SubstituteEnvVars

func SubstituteEnvVars(input string) string

Types

type AuthConfig

type AuthConfig struct {
	OIDC OIDCConfig `json:"oidc" yaml:"oidc"`
}

type BackupConfig

type BackupConfig struct {
	Directory string `json:"directory" yaml:"directory"`
	// Interval between backups, as a duration ("24h", "6h"). Empty uses the
	// default in the backup writer.
	Interval string `json:"interval" yaml:"interval"`
	// Retention is how many files to keep. Zero uses the writer's default.
	Retention int `json:"retention" yaml:"retention"`
}

BackupConfig schedules configuration backups.

Directory is deliberately required rather than defaulted. A backup carries decrypted credentials in plaintext — one file is every credential in the deployment — so writing one unattended is a decision an operator makes explicitly, not something that starts happening on upgrade because a default path existed. Empty means no schedule.

The directory must not be readable beyond its owner; the writer refuses at start-up otherwise. See RUNBOOK.md.

type BufferConfig

type BufferConfig struct {
	Type        string `json:"type" yaml:"type"`
	Size        int    `json:"size" yaml:"size"`
	Path        string `json:"path" yaml:"path"`
	Compression string `json:"compression" yaml:"compression"`
}

type Config

type Config struct {
	Engine        EngineConfig        `json:"engine" yaml:"engine"`
	Buffer        BufferConfig        `json:"buffer" yaml:"buffer"`
	Secrets       secrets.Config      `json:"secrets" yaml:"secrets"`
	StateStore    StateStoreConfig    `json:"state_store" yaml:"state_store"`
	Observability ObservabilityConfig `json:"observability" yaml:"observability"`
	Auth          AuthConfig          `json:"auth" yaml:"auth"`
	FileStorage   FileStorageConfig   `json:"file_storage" yaml:"file_storage"`
	Backup        BackupConfig        `json:"backup" yaml:"backup"`
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

type DBConfig

type DBConfig struct {
	Type            string `yaml:"type" json:"type"`
	Conn            string `yaml:"conn" json:"conn"`
	LogType         string `yaml:"log_type" json:"log_type"`
	LogConn         string `yaml:"log_conn" json:"log_conn"`
	JWTSecret       string `yaml:"jwt_secret" json:"jwt_secret"`
	CryptoMasterKey string `yaml:"crypto_master_key" json:"crypto_master_key"`
}

func LoadDBConfig

func LoadDBConfig() (*DBConfig, error)

type EngineConfig

type EngineConfig struct {
	MaxRetries        int           `json:"max_retries" yaml:"max_retries"`
	RetryInterval     time.Duration `json:"retry_interval" yaml:"retry_interval"`
	ReconnectInterval time.Duration `json:"reconnect_interval" yaml:"reconnect_interval"`
	MaxInflight       int           `json:"max_inflight" yaml:"max_inflight"`
	DrainTimeout      time.Duration `json:"drain_timeout" yaml:"drain_timeout"`
}

type FileStorageConfig

type FileStorageConfig struct {
	Type     string   `json:"type" yaml:"type"` // local, s3
	LocalDir string   `json:"local_dir" yaml:"local_dir"`
	S3       S3Config `json:"s3" yaml:"s3"`
}

type OIDCConfig

type OIDCConfig struct {
	Enabled      bool     `json:"enabled" yaml:"enabled"`
	IssuerURL    string   `json:"issuer_url" yaml:"issuer_url"`
	ClientID     string   `json:"client_id" yaml:"client_id"`
	ClientSecret string   `json:"client_secret" yaml:"client_secret"`
	RedirectURL  string   `json:"redirect_url" yaml:"redirect_url"`
	Scopes       []string `json:"scopes" yaml:"scopes"`
}

type OTLPConfig

type OTLPConfig struct {
	Endpoint    string            `json:"endpoint" yaml:"endpoint"`
	Protocol    string            `json:"protocol" yaml:"protocol"` // grpc or http
	Insecure    bool              `json:"insecure" yaml:"insecure"`
	Headers     map[string]string `json:"headers" yaml:"headers"`
	ServiceName string            `json:"service_name" yaml:"service_name"`
}

type ObservabilityConfig

type ObservabilityConfig struct {
	OTLP OTLPConfig `json:"otlp" yaml:"otlp"`
}

type S3Config

type S3Config struct {
	Endpoint        string `json:"endpoint" yaml:"endpoint"`
	Region          string `json:"region" yaml:"region"`
	Bucket          string `json:"bucket" yaml:"bucket"`
	AccessKeyID     string `json:"access_key_id" yaml:"access_key_id"`
	SecretAccessKey string `json:"secret_access_key" yaml:"secret_access_key"`
	UseSSL          bool   `json:"use_ssl" yaml:"use_ssl"`
}

type StateStoreConfig

type StateStoreConfig struct {
	Type     string `json:"type" yaml:"type"` // sqlite, redis, etcd
	Path     string `json:"path" yaml:"path"` // for sqlite
	Address  string `json:"address" yaml:"address"`
	Password string `json:"password" yaml:"password"`
	DB       int    `json:"db" yaml:"db"`
	Prefix   string `json:"prefix" yaml:"prefix"`
}

Jump to

Keyboard shortcuts

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