From 3422866909d5dfe177f986297e31b16a0694ec59 Mon Sep 17 00:00:00 2001 From: Alex Quick Date: Thu, 12 Oct 2017 22:50:29 -0400 Subject: [PATCH] [config] remove spurious newlines --- plugins/config/config.go | 6 ------ plugins/config/src/configenv/configenv.go | 1 - .../config/vendor/github.com/joho/godotenv/godotenv_test.go | 2 -- 3 files changed, 9 deletions(-) diff --git a/plugins/config/config.go b/plugins/config/config.go index b0ef6e435..61d4ddbd1 100644 --- a/plugins/config/config.go +++ b/plugins/config/config.go @@ -31,14 +31,11 @@ func HasKey(appName string, key string) bool { func SetMany(appName string, entries map[string]string, restart bool) { global := appName == "" env := GetConfig(appName, false) - keys := make([]string, 0, len(entries)) - for k, v := range entries { env.Set(k, v) keys = append(keys, k) } - if len(entries) != 0 { common.LogInfo1("Setting config vars") fmt.Println(PrettyPrintEnvEntries(" ", entries)) @@ -46,7 +43,6 @@ func SetMany(appName string, entries map[string]string, restart bool) { args := append([]string{appName, "set"}, keys...) common.PlugnTrigger("post-config-update", args...) } - if !global && restart && env.GetBoolDefault("DOKKU_APP_RESTORE", true) { Restart(appName) } @@ -62,13 +58,11 @@ func UnsetMany(appName string, keys []string, restart bool) { env.Unset(k) changed = true } - if changed { env.Write() args := append([]string{appName, "unset"}, keys...) common.PlugnTrigger("post-config-update", args...) } - if !global && restart && env.GetBoolDefault("DOKKU_APP_RESTORE", true) { Restart(appName) } diff --git a/plugins/config/src/configenv/configenv.go b/plugins/config/src/configenv/configenv.go index e0a8b0282..be8b1632d 100644 --- a/plugins/config/src/configenv/configenv.go +++ b/plugins/config/src/configenv/configenv.go @@ -148,7 +148,6 @@ func NewFromString(rep string) (*Env, error) { } func loadFromFile(name string, filename string) (env *Env, err error) { envMap := make(map[string]string) - if _, err := os.Stat(filename); err == nil { envMap, err = godotenv.Read(filename) } diff --git a/plugins/config/vendor/github.com/joho/godotenv/godotenv_test.go b/plugins/config/vendor/github.com/joho/godotenv/godotenv_test.go index 91f4363e9..cd9e2f309 100644 --- a/plugins/config/vendor/github.com/joho/godotenv/godotenv_test.go +++ b/plugins/config/vendor/github.com/joho/godotenv/godotenv_test.go @@ -350,7 +350,6 @@ func TestWrite(t *testing.T) { writeAndCompare(`foo="$ba\n\r\\r!"`, `foo="\$ba\n\r\\r\!"`) // lines should be sorted writeAndCompare("foo=bar\nbaz=buzz", "baz=\"buzz\"\nfoo=\"bar\"") - } func TestRoundtrip(t *testing.T) { @@ -372,6 +371,5 @@ func TestRoundtrip(t *testing.T) { if !reflect.DeepEqual(env, roundtripped) { t.Errorf("Expected '%s' to roundtrip as '%v', got '%v' instead", fixtureFilename, env, roundtripped) } - } }