1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-12-21 23:57:36 +02:00

feat: add ensure defaults to all migrated structs

Signed-off-by: Jan Larwig <jan@larwig.com>
This commit is contained in:
Jan Larwig
2025-10-30 09:26:14 +01:00
parent 51b1fd0510
commit 527c72f23f
14 changed files with 189 additions and 33 deletions

View File

@@ -5,7 +5,6 @@ import (
"os"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/apis/options"
"github.com/oauth2-proxy/oauth2-proxy/v7/pkg/util/ptr"
)
// validateProviders is the initial validation migration for multiple providrers
@@ -97,9 +96,9 @@ func validateGoogleConfig(provider options.Provider) []string {
hasAdminEmail := provider.GoogleConfig.AdminEmail != ""
hasSAJSON := provider.GoogleConfig.ServiceAccountJSON != ""
useADC := ptr.Deref(provider.GoogleConfig.UseApplicationDefaultCredentials, false)
useADC := provider.GoogleConfig.UseApplicationDefaultCredentials
if !hasAdminEmail && !hasSAJSON && !useADC {
if !hasAdminEmail && !hasSAJSON && !(*useADC) {
return msgs
}
@@ -108,7 +107,7 @@ func validateGoogleConfig(provider options.Provider) []string {
}
_, err := os.Stat(provider.GoogleConfig.ServiceAccountJSON)
if !useADC {
if !(*useADC) {
if !hasSAJSON {
msgs = append(msgs, "missing setting: google-service-account-json or google-use-application-default-credentials")
} else if err != nil {