append newlines for toml config

This commit is contained in:
Ulric Qin 2022-09-17 08:00:25 +08:00
parent 06a2989801
commit aa57d5b94f
1 changed files with 2 additions and 0 deletions

View File

@ -65,6 +65,7 @@ func LoadConfigByDir(configDir string, configPtr interface{}) error {
}
if len(tBuf) != 0 {
tBuf = append(tBuf, []byte("\n\n")...)
loaders = append(loaders, &multiconfig.TOMLLoader{Reader: bytes.NewReader(tBuf)})
}
if len(yBuf) != 0 {
@ -92,6 +93,7 @@ func LoadConfigs(configs []ConfigWithFormat, configPtr interface{}) error {
for _, c := range configs {
switch c.Format {
case TomlFormat:
tBuf = append(tBuf, []byte("\n\n")...)
tBuf = append(tBuf, []byte(c.Config)...)
case YamlFormat:
yBuf = append(yBuf, []byte(c.Config)...)