feat: Ajouter et documenter configuration par env

This commit is contained in:
Victor Lacasse-Beaudoin 2024-02-14 14:49:58 -05:00
parent 4b42f8d215
commit 990fe99e2c
3 changed files with 17 additions and 0 deletions

View file

@ -5,6 +5,7 @@ import (
"fmt"
"log"
"os"
"strings"
"git.agecem.com/agecem/bottin-ag/config"
"github.com/spf13/cobra"
@ -52,6 +53,8 @@ func initConfig() {
viper.SetConfigName(".bottin-ag")
}
viper.SetEnvPrefix("BOTTINAG")
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
viper.AutomaticEnv() // read in environment variables that match
// If a config file is found, read it in.