summaryrefslogtreecommitdiffstats
path: root/hugolib/config_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-11-24 14:11:42 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-11-25 20:34:34 +0100
commit7e223b3baaef68d6e6f99e28f162362c81deffba (patch)
treef518b27251b0cbd6cbd8fb1ba8f1ffbb419b6785 /hugolib/config_test.go
parent8a6e70605350255920100c5c085bb9ea6576d972 (diff)
Allow setting the delimiter used for setting config via OS env, e.g. HUGO_
Fixes #7829
Diffstat (limited to 'hugolib/config_test.go')
-rw-r--r--hugolib/config_test.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go
index cb9c1d8f6..e8dce331d 100644
--- a/hugolib/config_test.go
+++ b/hugolib/config_test.go
@@ -492,6 +492,11 @@ intSlice = [5,7,9]
floatSlice = [3.14, 5.19]
stringSlice = ["a", "b"]
+[params]
+[params.api_config]
+api_key="default_key"
+another_key="default another_key"
+
[imaging]
anchor = "smart"
quality = 75
@@ -508,6 +513,10 @@ quality = 75
"HUGO_STRINGSLICE", `["c", "d"]`,
"HUGO_INTSLICE", `[5, 8, 9]`,
"HUGO_FLOATSLICE", `[5.32]`,
+ // https://github.com/gohugoio/hugo/issues/7829
+ "HUGOxPARAMSxAPI_CONFIGxAPI_KEY", "new_key",
+ // Delimiters are case sensitive.
+ "HUGOxPARAMSxAPI_CONFIGXANOTHER_KEY", "another_key",
)
b.Build(BuildCfg{})
@@ -523,5 +532,7 @@ quality = 75
c.Assert(cfg.Get("stringSlice"), qt.DeepEquals, []interface{}{"c", "d"})
c.Assert(cfg.Get("floatSlice"), qt.DeepEquals, []interface{}{5.32})
c.Assert(cfg.Get("intSlice"), qt.DeepEquals, []interface{}{5, 8, 9})
+ c.Assert(cfg.Get("params.api_config.api_key"), qt.Equals, "new_key")
+ c.Assert(cfg.Get("params.api_config.another_key"), qt.Equals, "default another_key")
}