Skip to content

Commit 11f43b9

Browse files
authored
ci: add warning when configuration file is not present (#4391)
1 parent 5ae5656 commit 11f43b9

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

cmd/scw-sweeper/main.go

+9-7
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,22 @@ func main() {
3838
os.Exit(exitCode)
3939
}
4040

41-
func mainNoExit() int {
41+
func getConfigProfile() *scw.Profile {
4242
config, err := scw.LoadConfig()
4343
if err != nil {
44-
// handle error
45-
log.Fatal(err)
44+
return &scw.Profile{}
4645
}
47-
activeProfile, err := config.GetActiveProfile()
46+
profile, err := config.GetActiveProfile()
4847
if err != nil {
49-
// handle error
50-
log.Fatal(err)
48+
return &scw.Profile{}
5149
}
50+
return profile
51+
}
5252

53+
func mainNoExit() int {
54+
configProfile := getConfigProfile()
5355
envProfile := scw.LoadEnvProfile()
54-
profile := scw.MergeProfiles(activeProfile, envProfile)
56+
profile := scw.MergeProfiles(configProfile, envProfile)
5557

5658
client, err := scw.NewClient(
5759
scw.WithProfile(profile),

0 commit comments

Comments
 (0)