mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-16 13:17:19 +02:00
cmd/ctrld: always pass config file on windows start mode
On windows, the SYSTEM user is used to run ctrld service. This user has different environment with the user that run the `ctrld` binary via CLI. That causes the mismatch issue in config file path, log path, or more generally, everything that involve with home directory. To circumvent this pain, just always passing the config path and the original home dir in start mode. So `ctrld run` command can setup things correctly.
This commit is contained in:
committed by
Cuong Manh Le
parent
53306235dc
commit
8e164185b9
@@ -22,6 +22,7 @@ var (
|
||||
secondaryUpstream string
|
||||
domains []string
|
||||
logPath string
|
||||
homedir string
|
||||
cacheSize int
|
||||
cfg ctrld.Config
|
||||
verbose int
|
||||
@@ -44,6 +45,9 @@ func normalizeLogFilePath(logFilePath string) string {
|
||||
if logFilePath == "" || filepath.IsAbs(logFilePath) || service.Interactive() {
|
||||
return logFilePath
|
||||
}
|
||||
if homedir != "" {
|
||||
return filepath.Join(homedir, logFilePath)
|
||||
}
|
||||
dir, _ := os.UserHomeDir()
|
||||
if dir == "" {
|
||||
return logFilePath
|
||||
|
||||
Reference in New Issue
Block a user