mirror of
https://github.com/Luzifer/vault-openvpn.git
synced 2024-12-25 14:21:21 +00:00
Use a replacer to convert dashes
this enables setting all flags through ENV variables Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
a0b26ea1ae
commit
47d94f072a
1 changed files with 2 additions and 2 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/hashicorp/vault/api"
|
||||
|
@ -80,8 +81,7 @@ func init() {
|
|||
RootCmd.PersistentFlags().StringVar(&cfg.LogLevel, "log-level", "info", "Log level to use (debug, info, warning, error)")
|
||||
|
||||
viper.BindPFlags(RootCmd.PersistentFlags())
|
||||
viper.BindEnv("vault-addr", "VAULT_ADDR")
|
||||
viper.BindEnv("vault-token", "VAULT_TOKEN")
|
||||
viper.SetEnvKeyReplacer(strings.NewReplacer("-", "_"))
|
||||
|
||||
if tok := vaultTokenFromDisk(); tok != "" {
|
||||
viper.SetDefault("vault-token", tok)
|
||||
|
|
Loading…
Reference in a new issue