Skip to content

Commit c552351

Browse files
committed
Resolve merge conflicts
2 parents 122877f + 74bfb3d commit c552351

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Release (2025-XX-XX)
22

3+
- `core`: [v0.15.1](core/CHANGELOG.md#v0151-2025-01-08)
4+
- **Bugfix:** `ConfigureRegion` does not return an error if a region is set by an environment variable.
35
- `authorization`: [v0.5.0](services/authorization/CHANGELOG.md#v050-2025-01-09)
46
- **Feature:** Add support for regions in `APIClient`
57

core/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v0.15.1 (2025-01-08)
2+
3+
- **Bugfix:** `ConfigureRegion` does not return an error if a region is set by an enviroment variable.
4+
15
## v0.15.0 (2025-01-02)
26

37
- **Breaking Change:**: `ConfigureRegion` returns an error if a region is specified for a global URL.

core/config/config.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,10 +499,12 @@ func ConfigureRegion(cfg *Configuration) error {
499499
availableRegions = append(availableRegions, strings.TrimSuffix(regionWithDotSuffix, "."))
500500
}
501501

502+
isRegionSetByEnv := false
502503
if cfg.Region == "" {
503504
// Check region
504505
envVarRegion, _ := os.LookupEnv("STACKIT_REGION")
505506
cfg.Region = envVarRegion
507+
isRegionSetByEnv = true
506508
}
507509

508510
if oasRegion.DefaultValue != "" && oasRegion.DefaultValue != global {
@@ -524,9 +526,9 @@ func ConfigureRegion(cfg *Configuration) error {
524526
return fmt.Errorf("the provided region is not available for this API, available regions are: %s", availableRegions)
525527
}
526528
// Global API.
527-
// If a region is provided by the user via WithRegion() or via environment variable return an error.
529+
// If a region is provided by the user via WithRegion() return an error.
528530
// The region is provided as a function argument instead of being set in the client configuration.
529-
if cfg.Region != "" {
531+
if cfg.Region != "" && !isRegionSetByEnv {
530532
return fmt.Errorf("this API does not support setting a region in the the client configuration, please check if the region can be specified as a function parameter")
531533
}
532534
// If the url is a template, generated using deprecated config.json, the region variable is replaced

0 commit comments

Comments
 (0)