Skip to content

Commit

Permalink
cmd: fix hostd config write location
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed May 20, 2024
1 parent 148567c commit d20368b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmd/hostd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,13 @@ func setDataDirectory() {
}

func buildConfig() {
if _, err := os.Stat("hostd.yml"); err == nil {
// write the config file
configPath := "hostd.yml"
if str := os.Getenv("HOSTD_CONFIG_FILE"); str != "" {
configPath = str
}

if _, err := os.Stat(configPath); err == nil {
if !promptYesNo("hostd.yml already exists. Would you like to overwrite it?") {
return
}
Expand Down Expand Up @@ -297,7 +303,7 @@ func buildConfig() {
setAdvancedConfig()

// write the config file
f, err := os.Create("hostd.yml")
f, err := os.Create(configPath)
if err != nil {
stdoutFatalError("failed to create config file: " + err.Error())
return
Expand Down

0 comments on commit d20368b

Please sign in to comment.