From 3990cdc78fdc35ec5f33d51a40ac8f6258c95b93 Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Wed, 8 Jan 2025 11:33:49 +0100 Subject: [PATCH 1/5] Fix: ConfigureRegion() throws error if the region is set by environment variable --- core/config/config.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 From 5e7d4016d2507abdf9b69bc82701e0dfdadcc3f5 Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Wed, 8 Jan 2025 14:03:11 +0100 Subject: [PATCH 2/5] Add changelog --- core/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) 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. From 5b4698bb8f784c411180077a09b95491cf0f8f85 Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Wed, 8 Jan 2025 16:32:36 +0100 Subject: [PATCH 3/5] Add changes to CHANGELOG in root --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a061174a..01da8f50e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## Release (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) From baa4e7735b25d89ef609984e31595ce243a08005 Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Wed, 8 Jan 2025 16:38:37 +0100 Subject: [PATCH 4/5] Update changelog release date --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 01da8f50e..db7accb56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## Release (2025-01-08) +## Release (2025-XX-XX) - **Bugfix:** `ConfigureRegion` does not return an error if a region is set by an enviroment variable. From 86e9a564ad9458237c0428c8c2ec42f41e22e5f1 Mon Sep 17 00:00:00 2001 From: Marcel Jacek Date: Wed, 8 Jan 2025 16:59:38 +0100 Subject: [PATCH 5/5] Fix: Changelog format update --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db7accb56..c987b2811 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Release (2025-XX-XX) -- **Bugfix:** `ConfigureRegion` does not return an error if a region is set by an enviroment variable. +- `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)