Get configs from environment variables

This commit is contained in:
Paul Salaberria
2018-03-17 00:14:27 +01:00
parent c7c582cec4
commit 8c2e02519e

View File

@@ -17,12 +17,18 @@ package main
import (
"github.com/runatlantis/atlantis/cmd"
"github.com/spf13/viper"
"strings"
)
const atlantisVersion = "0.3.3"
func main() {
v := viper.New()
// Get environment variables with ATLANTIS prefix
v.SetEnvPrefix("ATLANTIS")
replacer := strings.NewReplacer("-","_")
v.SetEnvKeyReplacer(replacer)
v.AutomaticEnv()
// We're creating commands manually here rather than using init() functions
// (as recommended by cobra) because it makes testing easier.