diff options
author | Yann Autissier <aya@librezo.fr> | 2025-01-18 16:49:12 +0100 |
---|---|---|
committer | Yann Autissier <aya@librezo.fr> | 2025-01-18 16:49:12 +0100 |
commit | 8eb2f4403e924b21784d424df3452c2e165d4fb1 (patch) | |
tree | eb26fd05965f25a3fa9824c25e8fb2e19a78dd53 | |
parent | 1d338a9cc1a0ce06f964a89930e045be3eace510 (diff) | |
download | bottin-8eb2f4403e924b21784d424df3452c2e165d4fb1.tar.gz bottin-8eb2f4403e924b21784d424df3452c2e165d4fb1.zip |
Add Consul token configmain
Consul Token is used to provide a per-request ACL token
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | main.go | 6 |
2 files changed, 7 insertions, 0 deletions
@@ -87,6 +87,7 @@ suffix in the `suffix` key of the json config file. By default, Bottin connects to the Consul server on localhost. Change this by specifying the `consul_host` key in the json config file. +You may need a `consul_token` to connect to the Consul server. ### Bind addresses @@ -40,6 +40,7 @@ type ConfigFile struct { ConsulHost string `json:"consul_host"` ConsulConsistent bool `json:"consul_force_consistency"` + ConsulToken string `json:"consul_token"` Acl []string `json:"acl"` @@ -56,6 +57,7 @@ type Config struct { ConsulHost string ConsulConsistent bool + ConsulToken string Acl ACL @@ -114,6 +116,7 @@ func readConfig(logger *log.Logger) Config { ConsulHost: config_file.ConsulHost, ConsulConsistent: config_file.ConsulConsistent, + ConsulToken: config_file.ConsulToken, Acl: acl, } @@ -168,6 +171,9 @@ func main() { if config.ConsulHost != "" { consul_config.Address = config.ConsulHost } + if config.ConsulToken != "" { + consul_config.Token = config.ConsulToken + } consul_client, err := consul.NewClient(consul_config) if err != nil { logger.Fatal(err) |