From 8c2e02519e6b5ef34f62c4eb164900a0055a1082 Mon Sep 17 00:00:00 2001 From: Paul Salaberria Date: Sat, 17 Mar 2018 00:14:27 +0100 Subject: [PATCH] Get configs from environment variables --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index 0063e5664..4f0be780f 100644 --- a/main.go +++ b/main.go @@ -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.