Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 06cf167

Browse files
committed
fix: only write yml when origin format is yaml
1 parent 246f012 commit 06cf167

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

engine/config.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"os"
77
"path/filepath"
88
"reflect"
9+
"strings"
910
"time"
1011

1112
"github.com/spf13/viper"
@@ -222,7 +223,10 @@ func (c *Config) SyncViper(nc Config) {
222223

223224
func (c *Config) WriteDefault() error {
224225
cf := viper.ConfigFileUsed()
225-
return c.WriteYaml(cf)
226+
if strings.HasSuffix(cf, ".yml") || strings.HasSuffix(cf, ".yaml") {
227+
return c.WriteYaml(cf)
228+
}
229+
return viper.WriteConfig()
226230
}
227231

228232
func (c *Config) WriteYaml(cf string) error {

0 commit comments

Comments
 (0)