From 90677346514bf0c0c88f9a377f0973c9f0f244c5 Mon Sep 17 00:00:00 2001 From: avallete Date: Fri, 29 Nov 2024 15:46:48 +0100 Subject: [PATCH] wip: add switch --- pkg/config/updater.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/pkg/config/updater.go b/pkg/config/updater.go index 049cd4c46..d31661f4e 100644 --- a/pkg/config/updater.go +++ b/pkg/config/updater.go @@ -10,11 +10,12 @@ import ( ) type ConfigUpdater struct { - client v1API.ClientWithResponses + client v1API.ClientWithResponses + skipSecrets bool } -func NewConfigUpdater(client v1API.ClientWithResponses) ConfigUpdater { - return ConfigUpdater{client: client} +func NewConfigUpdater(client v1API.ClientWithResponses, skipSecrets bool) ConfigUpdater { + return ConfigUpdater{client: client, skipSecrets: skipSecrets} } func (u *ConfigUpdater) UpdateRemoteConfig(ctx context.Context, remote baseConfig, filter ...func(string) bool) error { @@ -123,7 +124,13 @@ func (u *ConfigUpdater) UpdateAuthConfig(ctx context.Context, projectRef string, return nil } } - if resp, err := u.client.V1UpdateAuthServiceConfigWithResponse(ctx, projectRef, c.StripUpdateBodySecrets(c.ToUpdateAuthConfigBody())); err != nil { + var updateBody v1API.UpdateAuthConfigBody + if u.skipSecrets { + updateBody = c.StripUpdateBodySecrets(c.ToUpdateAuthConfigBody()) + } else { + updateBody = c.ToUpdateAuthConfigBody() + } + if resp, err := u.client.V1UpdateAuthServiceConfigWithResponse(ctx, projectRef, updateBody); err != nil { return errors.Errorf("failed to update Auth config: %w", err) } else if status := resp.StatusCode(); status < 200 || status >= 300 { return errors.Errorf("unexpected status %d: %s", status, string(resp.Body))