1
0
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:
Alberto Bertogli
2020-05-16 23:22:00 +01:00
parent 7909b479eb
commit 4c28efcb20
6 changed files with 54 additions and 14 deletions

View File

@@ -204,7 +204,7 @@ func userRemove() {
// chasquid-util aliases-resolve <address>
func aliasesResolve() {
conf, err := config.Load(configDir + "/chasquid.conf")
conf, err := config.Load(configDir+"/chasquid.conf", "")
if err != nil {
Fatalf("Error loading config: %v", err)
}
@@ -248,7 +248,7 @@ func aliasesResolve() {
// chasquid-util print-config
func printConfig() {
conf, err := config.Load(configDir + "/chasquid.conf")
conf, err := config.Load(configDir+"/chasquid.conf", "")
if err != nil {
Fatalf("Error loading config: %v", err)
}
@@ -260,7 +260,7 @@ func printConfig() {
func domaininfoRemove() {
domain := args["<domain>"].(string)
conf, err := config.Load(configDir + "/chasquid.conf")
conf, err := config.Load(configDir+"/chasquid.conf", "")
if err != nil {
Fatalf("Error loading config: %v", err)
}
@@ -290,7 +290,7 @@ func aliasesAdd() {
Fatalf("Domain doesn't exist")
}
conf, err := config.Load(configDir + "/chasquid.conf")
conf, err := config.Load(configDir+"/chasquid.conf", "")
if err != nil {
Fatalf("Error loading config: %v", err)
}