mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
config: Allow overrides from the command line
This patch allows the configuration values to be overridden from the command-line, with a new -config_overrides flag. There is a fairly specific use case for this, when editing the configuration file is not feasible or convenient (e.g. running an user-supplied configuration in a managed environment).
This commit is contained in:
@@ -37,6 +37,8 @@ import (
|
||||
var (
|
||||
configDir = flag.String("config_dir", "/etc/chasquid",
|
||||
"configuration directory")
|
||||
configOverrides = flag.String("config_overrides", "",
|
||||
"override configuration values (in text protobuf format)")
|
||||
showVer = flag.Bool("version", false, "show version and exit")
|
||||
)
|
||||
|
||||
@@ -70,7 +72,7 @@ func main() {
|
||||
// Seed the PRNG, just to prevent for it to be totally predictable.
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
|
||||
conf, err := config.Load(*configDir + "/chasquid.conf")
|
||||
conf, err := config.Load(*configDir+"/chasquid.conf", *configOverrides)
|
||||
if err != nil {
|
||||
log.Fatalf("Error loading config: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user