[config] remove spurious newlines
This commit is contained in:
1 parent
b84635baf7
commit
3422866909
3 files changed
-9
No files matched your search
@@ -31,14 +31,11 @@ func HasKey(appName string, key string) bool {
|
|||||||
func SetMany(appName string, entries map[string]string, restart bool) {
|
func SetMany(appName string, entries map[string]string, restart bool) {
|
||||||
global := appName == ""
|
global := appName == ""
|
||||||
env := GetConfig(appName, false)
|
env := GetConfig(appName, false)
|
||||||
|
|
||||||
keys := make([]string, 0, len(entries))
|
keys := make([]string, 0, len(entries))
|
||||||
|
|
||||||
for k, v := range entries {
|
for k, v := range entries {
|
||||||
env.Set(k, v)
|
env.Set(k, v)
|
||||||
keys = append(keys, k)
|
keys = append(keys, k)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(entries) != 0 {
|
if len(entries) != 0 {
|
||||||
common.LogInfo1("Setting config vars")
|
common.LogInfo1("Setting config vars")
|
||||||
fmt.Println(PrettyPrintEnvEntries(" ", entries))
|
fmt.Println(PrettyPrintEnvEntries(" ", entries))
|
||||||
@@ -46,7 +43,6 @@ func SetMany(appName string, entries map[string]string, restart bool) {
|
|||||||
args := append([]string{appName, "set"}, keys...)
|
args := append([]string{appName, "set"}, keys...)
|
||||||
common.PlugnTrigger("post-config-update", args...)
|
common.PlugnTrigger("post-config-update", args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !global && restart && env.GetBoolDefault("DOKKU_APP_RESTORE", true) {
|
if !global && restart && env.GetBoolDefault("DOKKU_APP_RESTORE", true) {
|
||||||
Restart(appName)
|
Restart(appName)
|
||||||
}
|
}
|
||||||
@@ -62,13 +58,11 @@ func UnsetMany(appName string, keys []string, restart bool) {
|
|||||||
env.Unset(k)
|
env.Unset(k)
|
||||||
changed = true
|
changed = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if changed {
|
if changed {
|
||||||
env.Write()
|
env.Write()
|
||||||
args := append([]string{appName, "unset"}, keys...)
|
args := append([]string{appName, "unset"}, keys...)
|
||||||
common.PlugnTrigger("post-config-update", args...)
|
common.PlugnTrigger("post-config-update", args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
if !global && restart && env.GetBoolDefault("DOKKU_APP_RESTORE", true) {
|
if !global && restart && env.GetBoolDefault("DOKKU_APP_RESTORE", true) {
|
||||||
Restart(appName)
|
Restart(appName)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,6 @@ func NewFromString(rep string) (*Env, error) {
|
|||||||
}
|
}
|
||||||
func loadFromFile(name string, filename string) (env *Env, err error) {
|
func loadFromFile(name string, filename string) (env *Env, err error) {
|
||||||
envMap := make(map[string]string)
|
envMap := make(map[string]string)
|
||||||
|
|
||||||
if _, err := os.Stat(filename); err == nil {
|
if _, err := os.Stat(filename); err == nil {
|
||||||
envMap, err = godotenv.Read(filename)
|
envMap, err = godotenv.Read(filename)
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -350,7 +350,6 @@ func TestWrite(t *testing.T) {
|
|||||||
writeAndCompare(`foo="$ba\n\r\\r!"`, `foo="\$ba\n\r\\r\!"`)
|
writeAndCompare(`foo="$ba\n\r\\r!"`, `foo="\$ba\n\r\\r\!"`)
|
||||||
// lines should be sorted
|
// lines should be sorted
|
||||||
writeAndCompare("foo=bar\nbaz=buzz", "baz=\"buzz\"\nfoo=\"bar\"")
|
writeAndCompare("foo=bar\nbaz=buzz", "baz=\"buzz\"\nfoo=\"bar\"")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRoundtrip(t *testing.T) {
|
func TestRoundtrip(t *testing.T) {
|
||||||
@@ -372,6 +371,5 @@ func TestRoundtrip(t *testing.T) {
|
|||||||
if !reflect.DeepEqual(env, roundtripped) {
|
if !reflect.DeepEqual(env, roundtripped) {
|
||||||
t.Errorf("Expected '%s' to roundtrip as '%v', got '%v' instead", fixtureFilename, env, roundtripped)
|
t.Errorf("Expected '%s' to roundtrip as '%v', got '%v' instead", fixtureFilename, env, roundtripped)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user