mirror of
https://github.com/jeessy2/ddns-go.git
synced 2025-10-20 15:33:46 +08:00
* fix: different `configFilePath` for normal and SYSTEM users In Windows, the home directories for normal user and SYSTEM user are different. Add `-c` option to fix this issue. * Revert #579 This reverts commit 8c4974a.
This commit is contained in:
12
main.go
12
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 {
|
||||
|
@ -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"
|
||||
|
Reference in New Issue
Block a user