Skip to content

Commit dc67bb7

Browse files
committed
Fix json marshal of secrets
1 parent be1aec3 commit dc67bb7

File tree

2 files changed

+32
-27
lines changed

2 files changed

+32
-27
lines changed

coderd/coderdtest/coderdtest.go

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -394,31 +394,30 @@ func NewOptions(t testing.TB, options *Options) (func(http.Handler), context.Can
394394
Pubsub: options.Pubsub,
395395
GitAuthConfigs: options.GitAuthConfigs,
396396

397-
Auditor: options.Auditor,
398-
AWSCertificates: options.AWSCertificates,
399-
AzureCertificates: options.AzureCertificates,
400-
GithubOAuth2Config: options.GithubOAuth2Config,
401-
RealIPConfig: options.RealIPConfig,
402-
OIDCConfig: options.OIDCConfig,
403-
GoogleTokenValidator: options.GoogleTokenValidator,
404-
SSHKeygenAlgorithm: options.SSHKeygenAlgorithm,
405-
DERPServer: derpServer,
406-
APIRateLimit: options.APIRateLimit,
407-
LoginRateLimit: options.LoginRateLimit,
408-
FilesRateLimit: options.FilesRateLimit,
409-
Authorizer: options.Authorizer,
410-
Telemetry: telemetry.NewNoop(),
411-
TemplateScheduleStore: &templateScheduleStore,
412-
TLSCertificates: options.TLSCertificates,
413-
TrialGenerator: options.TrialGenerator,
414-
TailnetCoordinator: options.Coordinator,
415-
BaseDERPMap: derpMap,
416-
DERPMapUpdateFrequency: 150 * time.Millisecond,
417-
MetricsCacheRefreshInterval: options.MetricsCacheRefreshInterval,
418-
AgentStatsRefreshInterval: options.AgentStatsRefreshInterval,
419-
DeploymentValues: options.DeploymentValues,
420-
// For tests, we don't have any `value_source` fields set.
421-
DeploymentOptions: options.DeploymentValues.Options(),
397+
Auditor: options.Auditor,
398+
AWSCertificates: options.AWSCertificates,
399+
AzureCertificates: options.AzureCertificates,
400+
GithubOAuth2Config: options.GithubOAuth2Config,
401+
RealIPConfig: options.RealIPConfig,
402+
OIDCConfig: options.OIDCConfig,
403+
GoogleTokenValidator: options.GoogleTokenValidator,
404+
SSHKeygenAlgorithm: options.SSHKeygenAlgorithm,
405+
DERPServer: derpServer,
406+
APIRateLimit: options.APIRateLimit,
407+
LoginRateLimit: options.LoginRateLimit,
408+
FilesRateLimit: options.FilesRateLimit,
409+
Authorizer: options.Authorizer,
410+
Telemetry: telemetry.NewNoop(),
411+
TemplateScheduleStore: &templateScheduleStore,
412+
TLSCertificates: options.TLSCertificates,
413+
TrialGenerator: options.TrialGenerator,
414+
TailnetCoordinator: options.Coordinator,
415+
BaseDERPMap: derpMap,
416+
DERPMapUpdateFrequency: 150 * time.Millisecond,
417+
MetricsCacheRefreshInterval: options.MetricsCacheRefreshInterval,
418+
AgentStatsRefreshInterval: options.AgentStatsRefreshInterval,
419+
DeploymentValues: options.DeploymentValues,
420+
DeploymentOptions: codersdk.DeploymentOptionsWithoutSecrets(options.DeploymentValues.Options()),
422421
UpdateCheckOptions: options.UpdateCheckOptions,
423422
SwaggerEndpoint: options.SwaggerEndpoint,
424423
AppSecurityKey: AppSecurityKey,

codersdk/deployment.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1768,8 +1768,14 @@ func DeploymentOptionsWithoutSecrets(set clibase.OptionSet) clibase.OptionSet {
17681768
for _, opt := range set {
17691769
cpyOpt := opt
17701770
if IsSecretDeploymentOption(cpyOpt) {
1771-
var empty clibase.String
1772-
cpyOpt.Value = &empty
1771+
switch cpyOpt.Value.Type() {
1772+
case "string-array":
1773+
var empty clibase.StringArray
1774+
cpyOpt.Value = &empty
1775+
default:
1776+
var empty clibase.String
1777+
cpyOpt.Value = &empty
1778+
}
17731779
}
17741780
cpy = append(cpy, cpyOpt)
17751781
}

0 commit comments

Comments
 (0)