Install writes a fully commented sample env file when no config exists
This commit is contained in:
@@ -172,10 +172,16 @@ func Install(configPath string, copyBin bool) error {
|
||||
}
|
||||
}
|
||||
}
|
||||
// A service has no console: without LOG_FILE the output vanishes, so
|
||||
// the installed env file defaults to logging into ProgramData. An
|
||||
// existing LOG_FILE setting is left alone.
|
||||
if err := ensureLogFile(targetCfg, filepath.Join(dataDir, "gpu-turnstile.log")); err != nil {
|
||||
// A service has no console: without LOG_FILE the output vanishes.
|
||||
// With no config at all, install a fully commented sample covering
|
||||
// every setting (only LOG_FILE active); an existing config just gets
|
||||
// a LOG_FILE line appended if it has none.
|
||||
logPath := filepath.Join(dataDir, "gpu-turnstile.log")
|
||||
if _, statErr := os.Stat(targetCfg); os.IsNotExist(statErr) {
|
||||
if err := os.WriteFile(targetCfg, []byte(config.SampleEnv(logPath)), 0o644); err != nil {
|
||||
return fmt.Errorf("write %s: %w", targetCfg, err)
|
||||
}
|
||||
} else if err := ensureLogFile(targetCfg, logPath); err != nil {
|
||||
return err
|
||||
}
|
||||
configPath = targetCfg
|
||||
|
||||
Reference in New Issue
Block a user