diff --git a/main.go b/main.go index dbf7db938..0de157725 100644 --- a/main.go +++ b/main.go @@ -166,22 +166,12 @@ func getService() service.Service { options["SysvScript"] = sysvScript } - dir, err := os.UserHomeDir() - if err != nil { - log.Println("Getting Home directory failed: ", err) - } - svcConfig := &service.Config{ Name: "ddns-go", DisplayName: "ddns-go", Description: "简单好用的DDNS。自动更新域名解析到公网IP(支持阿里云、腾讯云dnspod、Cloudflare、Callback、华为云、百度云、porkbun、GoDaddy、Google Domains)", - Arguments: []string{"-l", *listen, "-f", strconv.Itoa(*every)}, + Arguments: []string{"-l", *listen, "-f", strconv.Itoa(*every), "-c", *configFilePath}, Option: options, - EnvVars: map[string]string{"HOME": dir}, - } - - if *configFilePath != util.GetConfigFilePathDefault() { - svcConfig.Arguments = append(svcConfig.Arguments, "-c", *configFilePath) } if *noWebService { diff --git a/util/user.go b/util/user.go index f6513f84a..ad7b08305 100644 --- a/util/user.go +++ b/util/user.go @@ -1,7 +1,6 @@ package util import ( - "log" "os" ) @@ -20,7 +19,7 @@ func GetConfigFilePath() string { func GetConfigFilePathDefault() string { dir, err := os.UserHomeDir() if err != nil { - log.Println("Getting Home directory failed: ", err) + // log.Println("Getting Home directory failed: ", err) return "../.ddns_go_config.yaml" } return dir + string(os.PathSeparator) + ".ddns_go_config.yaml"