Skip to content

Commit 69f5571

Browse files
authored
ci(nightly): fix missing config error (scaleway#2658)
1 parent 0b5c3c5 commit 69f5571

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

internal/testhelpers/httprecorder/recorder.go

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ func CreateRecordedScwClient(cassetteName string) (*scw.Client, *recorder.Record
3737
recorderMode = recorder.ModeRecording
3838
config, err := scw.LoadConfig()
3939
if err != nil {
40-
return nil, nil, err
41-
}
42-
activeProfile, err = config.GetActiveProfile()
43-
if err != nil {
44-
return nil, nil, err
40+
activeProfile = &scw.Profile{}
41+
} else {
42+
activeProfile, err = config.GetActiveProfile()
43+
if err != nil {
44+
return nil, nil, err
45+
}
4546
}
4647
}
4748

@@ -57,7 +58,12 @@ func CreateRecordedScwClient(cassetteName string) (*scw.Client, *recorder.Record
5758
delete(i.Request.Headers, "X-Auth-Token")
5859

5960
if UpdateCassette {
60-
secretKey := *activeProfile.SecretKey
61+
var secretKey string
62+
if activeProfile != nil && activeProfile.SecretKey != nil {
63+
secretKey = *activeProfile.SecretKey
64+
} else {
65+
secretKey = os.Getenv("SCW_SECRET_KEY")
66+
}
6167
if i != nil && strings.Contains(fmt.Sprintf("%v", *i), secretKey) {
6268
panic(errors.New("found secret key in cassette"))
6369
}

0 commit comments

Comments
 (0)