Skip to content

Commit

Permalink
fix: write default config in XDG config dir to avoid cluttering the H…
Browse files Browse the repository at this point in the history
…OME directory by default (#2140)

Co-authored-by: Casey Lee <cplee@nektos.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Jan 21, 2024
1 parent 8072a00 commit 6091094
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ func Execute(ctx context.Context, version string) {
}
}

// Return locations where Act's config can be found in order : XDG spec, .actrc in HOME directory, .actrc in invocation directory
func configLocations() []string {
configFileName := ".actrc"

Expand All @@ -120,8 +121,8 @@ func configLocations() []string {
}

return []string{
filepath.Join(UserHomeDir, configFileName),
actrcXdg,
filepath.Join(UserHomeDir, configFileName),
filepath.Join(".", configFileName),
}
}
Expand Down Expand Up @@ -557,6 +558,7 @@ func newRunCommand(ctx context.Context, input *Input) func(*cobra.Command, []str
}
}
if !cfgFound && len(cfgLocations) > 0 {
// The first config location refers to the XDG spec one
if err := defaultImageSurvey(cfgLocations[0]); err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit 6091094

Please sign in to comment.