Explorar o código

修复,读取配置文件的bug

Signed-off-by: allan716 <[email protected]>
allan716 %!s(int64=3) %!d(string=hai) anos
pai
achega
858a48ea6a
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      pkg/settings/settings.go

+ 4 - 4
pkg/settings/settings.go

@@ -107,13 +107,13 @@ func NewSettings(configRootDirFPath string) *Settings {
 
 func (s *Settings) read() error {
 
-	// 需要检查 url 是否正确
-	newEmbyAddressUrl := removeSuffixAddressSlash(s.EmbySettings.AddressUrl)
-	_, err := url.Parse(newEmbyAddressUrl)
+	err := strcut_json.ToStruct(s.configFPath, s)
 	if err != nil {
 		return err
 	}
-	err = strcut_json.ToStruct(s.configFPath, s)
+	// 需要检查 url 是否正确
+	newEmbyAddressUrl := removeSuffixAddressSlash(s.EmbySettings.AddressUrl)
+	_, err = url.Parse(newEmbyAddressUrl)
 	if err != nil {
 		return err
 	}