Merge pull request 'feature: add replacer for ENV vars' (#36) from feature/env-replacer into main

Reviewed-on: #36
This commit is contained in:
Victor Lacasse-Beaudoin 2024-02-19 12:12:48 -05:00
commit 6ddd419ed0

View file

@ -3,6 +3,7 @@ package cmd
import (
"fmt"
"os"
"strings"
"codeberg.org/vlbeaudoin/serpents"
"github.com/spf13/cobra"
@ -138,6 +139,8 @@ func initConfig() {
viper.SetConfigName(".bottin-agenda")
}
viper.SetEnvPrefix("BOTTINAGENDA")
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
viper.AutomaticEnv() // read in environment variables that match
// If a config file is found, read it in.