diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a061174a..c987b2811 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## Release (2025-XX-XX) + +- `core`: [v0.15.1](core/CHANGELOG.md#v0151-2025-01-08) + - **Bugfix:** `ConfigureRegion` does not return an error if a region is set by an enviroment variable. + ## Release (2025-01-07) - `postgresflex`: [0.16.1](services/postgresflex/CHANGELOG.md#v0161-2025-xx-yy) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 1053a9d2e..129d2cafe 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.15.1 (2025-01-08) + +- **Bugfix:** `ConfigureRegion` does not return an error if a region is set by an enviroment variable. + ## v0.15.0 (2025-01-02) - **Breaking Change:**: `ConfigureRegion` returns an error if a region is specified for a global URL. diff --git a/core/config/config.go b/core/config/config.go index 7bf2ed069..8eb174921 100644 --- a/core/config/config.go +++ b/core/config/config.go @@ -499,10 +499,12 @@ func ConfigureRegion(cfg *Configuration) error { availableRegions = append(availableRegions, strings.TrimSuffix(regionWithDotSuffix, ".")) } + isRegionSetByEnv := false if cfg.Region == "" { // Check region envVarRegion, _ := os.LookupEnv("STACKIT_REGION") cfg.Region = envVarRegion + isRegionSetByEnv = true } if oasRegion.DefaultValue != "" && oasRegion.DefaultValue != global { @@ -524,9 +526,9 @@ func ConfigureRegion(cfg *Configuration) error { return fmt.Errorf("the provided region is not available for this API, available regions are: %s", availableRegions) } // Global API. - // If a region is provided by the user via WithRegion() or via environment variable return an error. + // If a region is provided by the user via WithRegion() return an error. // The region is provided as a function argument instead of being set in the client configuration. - if cfg.Region != "" { + if cfg.Region != "" && !isRegionSetByEnv { 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") } // If the url is a template, generated using deprecated config.json, the region variable is replaced