mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
Add support for multiple config files via --config a.toml,b.toml,c.toml
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
c8257f8b72
commit
0f9f73cce5
@@ -41,3 +41,27 @@ func TestLoadConfig(t *testing.T) {
|
||||
// default
|
||||
assert.Equal(t, "layouts", cfg.GetString("layoutDir"))
|
||||
}
|
||||
func TestLoadMultiConfig(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
// Add a random config variable for testing.
|
||||
// side = page in Norwegian.
|
||||
configContentBase := `
|
||||
DontChange = "same"
|
||||
PaginatePath = "side"
|
||||
`
|
||||
configContentSub := `
|
||||
PaginatePath = "top"
|
||||
`
|
||||
mm := afero.NewMemMapFs()
|
||||
|
||||
writeToFs(t, mm, "base.toml", configContentBase)
|
||||
|
||||
writeToFs(t, mm, "override.toml", configContentSub)
|
||||
|
||||
cfg, err := LoadConfig(mm, "", "base.toml,override.toml")
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Equal(t, "top", cfg.GetString("paginatePath"))
|
||||
assert.Equal(t, "same", cfg.GetString("DontChange"))
|
||||
}
|
||||
|
Reference in New Issue
Block a user