Skip to content

Commit ac997a9

Browse files
committed
chore: Return populated options vs a blank
1 parent 8cff623 commit ac997a9

File tree

4 files changed

+33
-25
lines changed

4 files changed

+33
-25
lines changed

cli/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
617617
MetricsCacheRefreshInterval: vals.MetricsCacheRefreshInterval.Value(),
618618
AgentStatsRefreshInterval: vals.AgentStatRefreshInterval.Value(),
619619
DeploymentValues: vals,
620+
DeploymentOptions: opts,
620621
PrometheusRegistry: prometheus.NewRegistry(),
621622
APIRateLimit: int(vals.RateLimit.API.Value()),
622623
LoginRateLimit: loginRateLimit,

coderd/coderd.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040

4141
"cdr.dev/slog"
4242
"github.com/coder/coder/v2/buildinfo"
43+
"github.com/coder/coder/v2/cli/clibase"
4344
"github.com/coder/coder/v2/coderd/audit"
4445
"github.com/coder/coder/v2/coderd/awsidentity"
4546
"github.com/coder/coder/v2/coderd/batchstats"
@@ -152,7 +153,11 @@ type Options struct {
152153
MetricsCacheRefreshInterval time.Duration
153154
AgentStatsRefreshInterval time.Duration
154155
DeploymentValues *codersdk.DeploymentValues
155-
UpdateCheckOptions *updatecheck.Options // Set non-nil to enable update checking.
156+
// DeploymentOptions do contain the copy of DeploymentValues, but contain
157+
// contextual information about how the values were set.
158+
// Do not use DeploymentOptions to retrieve values, use DeploymentValues instead.
159+
DeploymentOptions clibase.OptionSet
160+
UpdateCheckOptions *updatecheck.Options // Set non-nil to enable update checking.
156161

157162
// SSHConfig is the response clients use to configure config-ssh locally.
158163
SSHConfig codersdk.SSHConfigResponse

coderd/coderdtest/coderdtest.go

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -394,29 +394,31 @@ 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,
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(),
420422
UpdateCheckOptions: options.UpdateCheckOptions,
421423
SwaggerEndpoint: options.SwaggerEndpoint,
422424
AppSecurityKey: AppSecurityKey,

coderd/deployment.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (api *API) deploymentValues(rw http.ResponseWriter, r *http.Request) {
3333
r.Context(), rw, http.StatusOK,
3434
codersdk.DeploymentConfig{
3535
Values: values,
36-
Options: values.Options(),
36+
Options: api.DeploymentOptions,
3737
},
3838
)
3939
}

0 commit comments

Comments
 (0)