[config] remove spurious newlines

This commit is contained in:
Alex Quick
2017-10-12 22:50:29 -04:00
parent b84635baf7
commit 3422866909
3 changed files with 0 additions and 9 deletions

View File

@@ -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)
}

View File

@@ -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)
}

View File

@@ -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)
}
}
}