Skip to content

Commit

Permalink
Print restart instructions if required.
Browse files Browse the repository at this point in the history
  • Loading branch information
ndarilek committed Jul 17, 2024
1 parent c40d8e8 commit 7987ec7
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions cmd/flexctl/backups.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,19 @@ type configShowResult struct {
Result flypg.BarmanSettings `json:"result"`
}

func getApiUrl() (string, error) {
hostname := os.Getenv("FLY_APP_NAME")
if hostname == "" {
func getAppName() (string, error) {
name := os.Getenv("FLY_APP_NAME")
if name == "" {
return "", fmt.Errorf("FLY_APP_NAME is not set")
}
return name, nil
}

func getApiUrl() (string, error) {
hostname, err := getAppName()
if err != nil {
return "", err
}
url := fmt.Sprintf("http://%s.internal:5500", hostname)
return url, nil
}
Expand Down Expand Up @@ -360,7 +368,11 @@ func newConfigUpdate() *cobra.Command {
}

if rv.Result.RestartRequired {
fmt.Println("A restart is required for these changes to take effect.")
appName, err := getAppName()
if err != nil {
return err
}
fmt.Printf("A restart is required for these changes to take effect. Run `fly app restart %s` to restart.)", appName)
}

return nil
Expand Down

0 comments on commit 7987ec7

Please sign in to comment.