Skip to content

Commit d27ce4f

Browse files
committed
Fix eu api key
1 parent 3e0c076 commit d27ce4f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

api/client/client.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ func CreateOts(ctx context.Context, encryptedBytes []byte, expiresIn time.Durati
5959
return nil, fmt.Errorf("no API URL configured for region: %s", region)
6060
}
6161

62-
apiKey := viper.GetString("apiKey")
62+
apiKey := viper.GetString(fmt.Sprintf("apiKey.%s", region))
63+
if apiKey == "" {
64+
return nil, fmt.Errorf("no API key configured for region: %s", region)
65+
}
6366

6467
// Build the request
6568
reqURL, err := url.Parse(apiURL)
@@ -86,11 +89,7 @@ func CreateOts(ctx context.Context, encryptedBytes []byte, expiresIn time.Durati
8689
req.Header.Set("Content-Type", "application/json")
8790
req.Header.Set("X-Client-Name", "ots-cli")
8891
req.Header.Set("X-Client-Version", build.Version)
89-
90-
// Add optional authentication (for self-hosted)
91-
if apiKey != "" {
92-
req.Header.Set("X-Api-Key", apiKey)
93-
}
92+
req.Header.Set("X-Api-Key", apiKey)
9493

9594
client := &http.Client{
9695
Timeout: 30 * time.Second,

0 commit comments

Comments
 (0)