ceremonyclient/config/alias.go
Cassandra Heart dbd95bd9e9
v2.1.0 (#439)
* v2.1.0 [omit consensus and adjacent] - this commit will be amended with the full release after the file copy is complete

* 2.1.0 main node rollup
2025-09-30 02:48:15 -05:00

29 lines
688 B
Go

package config
import "path/filepath"
// Simple configuration for store of alias mappings
type AliasConfig struct {
AliasFile *AliasFileConfig `yaml:"aliasFile"`
}
type AliasFileConfig struct {
Path string `yaml:"path"`
CreateIfMissing bool `yaml:"createIfMissing"`
}
// WithDefaults returns a copy of the AliasConfig with any missing fields set to
// their default values.
func (c AliasConfig) WithDefaults(configPath string) AliasConfig {
cpy := c
if cpy.AliasFile == nil {
cpy.AliasFile = &AliasFileConfig{}
}
if cpy.AliasFile.Path == "" {
cpy.AliasFile.Path = filepath.Join(configPath, "alias.yml")
cpy.AliasFile.CreateIfMissing = true
}
return cpy
}