Skip to content

Commit

Permalink
ci: add warning when configuration file is not present (#4391)
Browse files Browse the repository at this point in the history
  • Loading branch information
remyleone authored Dec 30, 2024
1 parent 5ae5656 commit 11f43b9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions cmd/scw-sweeper/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,22 @@ func main() {
os.Exit(exitCode)
}

func mainNoExit() int {
func getConfigProfile() *scw.Profile {
config, err := scw.LoadConfig()
if err != nil {
// handle error
log.Fatal(err)
return &scw.Profile{}
}
activeProfile, err := config.GetActiveProfile()
profile, err := config.GetActiveProfile()
if err != nil {
// handle error
log.Fatal(err)
return &scw.Profile{}
}
return profile
}

func mainNoExit() int {
configProfile := getConfigProfile()
envProfile := scw.LoadEnvProfile()
profile := scw.MergeProfiles(activeProfile, envProfile)
profile := scw.MergeProfiles(configProfile, envProfile)

client, err := scw.NewClient(
scw.WithProfile(profile),
Expand Down

0 comments on commit 11f43b9

Please sign in to comment.