Skip to content

Commit c41bdc2

Browse files
authored
fix: Add names to config properties for the UI (#4718)
This was reverted in the configuration PR, which broke the UI.
1 parent bf3224e commit c41bdc2

File tree

4 files changed

+56
-5
lines changed

4 files changed

+56
-5
lines changed

cli/deployment/config.go

+53
Original file line numberDiff line numberDiff line change
@@ -22,299 +22,352 @@ import (
2222
func newConfig() codersdk.DeploymentConfig {
2323
return codersdk.DeploymentConfig{
2424
AccessURL: codersdk.DeploymentConfigField[string]{
25+
Name: "Access URL",
2526
Key: "access_url",
2627
Usage: "External URL to access your deployment. This must be accessible by all provisioned workspaces.",
2728
Flag: "access-url",
2829
},
2930
WildcardAccessURL: codersdk.DeploymentConfigField[string]{
31+
Name: "Wildcard Access URL",
3032
Key: "wildcard_access_url",
3133
Usage: "Specifies the wildcard hostname to use for workspace applications in the form \"*.example.com\".",
3234
Flag: "wildcard-access-url",
3335
},
3436
Address: codersdk.DeploymentConfigField[string]{
37+
Name: "Address",
3538
Key: "address",
3639
Usage: "Bind address of the server.",
3740
Flag: "address",
3841
Shorthand: "a",
3942
Value: "127.0.0.1:3000",
4043
},
4144
AutobuildPollInterval: codersdk.DeploymentConfigField[time.Duration]{
45+
Name: "Autobuild Poll Interval",
4246
Key: "autobuild_poll_interval",
4347
Usage: "Interval to poll for scheduled workspace builds.",
4448
Flag: "autobuild-poll-interval",
4549
Hidden: true,
4650
Value: time.Minute,
4751
},
4852
DERPServerEnable: codersdk.DeploymentConfigField[bool]{
53+
Name: "DERP Server Enable",
4954
Key: "derp.server.enable",
5055
Usage: "Whether to enable or disable the embedded DERP relay server.",
5156
Flag: "derp-server-enable",
5257
Value: true,
5358
},
5459
DERPServerRegionID: codersdk.DeploymentConfigField[int]{
60+
Name: "DERP Server Region ID",
5561
Key: "derp.server.region_id",
5662
Usage: "Region ID to use for the embedded DERP server.",
5763
Flag: "derp-server-region-id",
5864
Value: 999,
5965
},
6066
DERPServerRegionCode: codersdk.DeploymentConfigField[string]{
67+
Name: "DERP Server Region Code",
6168
Key: "derp.server.region_code",
6269
Usage: "Region code to use for the embedded DERP server.",
6370
Flag: "derp-server-region-code",
6471
Value: "coder",
6572
},
6673
DERPServerRegionName: codersdk.DeploymentConfigField[string]{
74+
Name: "DERP Server Region Name",
6775
Key: "derp.server.region_name",
6876
Usage: "Region name that for the embedded DERP server.",
6977
Flag: "derp-server-region-name",
7078
Value: "Coder Embedded Relay",
7179
},
7280
DERPServerSTUNAddresses: codersdk.DeploymentConfigField[[]string]{
81+
Name: "DERP Server STUN Addresses",
7382
Key: "derp.server.stun_addresses",
7483
Usage: "Addresses for STUN servers to establish P2P connections. Set empty to disable P2P connections.",
7584
Flag: "derp-server-stun-addresses",
7685
Value: []string{"stun.l.google.com:19302"},
7786
},
7887
DERPServerRelayURL: codersdk.DeploymentConfigField[string]{
88+
Name: "DERP Server Relay URL",
7989
Key: "derp.server.relay_url",
8090
Usage: "An HTTP URL that is accessible by other replicas to relay DERP traffic. Required for high availability.",
8191
Flag: "derp-server-relay-url",
8292
Enterprise: true,
8393
},
8494
DERPConfigURL: codersdk.DeploymentConfigField[string]{
95+
Name: "DERP Config URL",
8596
Key: "derp.config.url",
8697
Usage: "URL to fetch a DERP mapping on startup. See: https://tailscale.com/kb/1118/custom-derp-servers/",
8798
Flag: "derp-config-url",
8899
},
89100
DERPConfigPath: codersdk.DeploymentConfigField[string]{
101+
Name: "DERP Config Path",
90102
Key: "derp.config.path",
91103
Usage: "Path to read a DERP mapping from. See: https://tailscale.com/kb/1118/custom-derp-servers/",
92104
Flag: "derp-config-path",
93105
},
94106
PrometheusEnable: codersdk.DeploymentConfigField[bool]{
107+
Name: "Prometheus Enable",
95108
Key: "prometheus.enable",
96109
Usage: "Serve prometheus metrics on the address defined by prometheus address.",
97110
Flag: "prometheus-enable",
98111
},
99112
PrometheusAddress: codersdk.DeploymentConfigField[string]{
113+
Name: "Prometheus Address",
100114
Key: "prometheus.address",
101115
Usage: "The bind address to serve prometheus metrics.",
102116
Flag: "prometheus-address",
103117
Value: "127.0.0.1:2112",
104118
},
105119
PprofEnable: codersdk.DeploymentConfigField[bool]{
120+
Name: "Pprof Enable",
106121
Key: "pprof.enable",
107122
Usage: "Serve pprof metrics on the address defined by pprof address.",
108123
Flag: "pprof-enable",
109124
},
110125
PprofAddress: codersdk.DeploymentConfigField[string]{
126+
Name: "Pprof Address",
111127
Key: "pprof.address",
112128
Usage: "The bind address to serve pprof.",
113129
Flag: "pprof-address",
114130
Value: "127.0.0.1:6060",
115131
},
116132
ProxyTrustedHeaders: codersdk.DeploymentConfigField[[]string]{
133+
Name: "Proxy Trusted Headers",
117134
Key: "proxy.trusted_headers",
118135
Flag: "proxy-trusted-headers",
119136
Usage: "Headers to trust for forwarding IP addresses. e.g. Cf-Connecting-IP True-Client-Ip, X-Forwarded-for",
120137
},
121138
ProxyTrustedOrigins: codersdk.DeploymentConfigField[[]string]{
139+
Name: "Proxy Trusted Origins",
122140
Key: "proxy.trusted_origins",
123141
Flag: "proxy-trusted-origins",
124142
Usage: "Origin addresses to respect \"proxy-trusted-headers\". e.g. example.com",
125143
},
126144
CacheDirectory: codersdk.DeploymentConfigField[string]{
145+
Name: "Cache Directory",
127146
Key: "cache_directory",
128147
Usage: "The directory to cache temporary files. If unspecified and $CACHE_DIRECTORY is set, it will be used for compatibility with systemd.",
129148
Flag: "cache-dir",
130149
Value: defaultCacheDir(),
131150
},
132151
InMemoryDatabase: codersdk.DeploymentConfigField[bool]{
152+
Name: "In Memory Database",
133153
Key: "in_memory_database",
134154
Usage: "Controls whether data will be stored in an in-memory database.",
135155
Flag: "in-memory",
136156
Hidden: true,
137157
},
138158
ProvisionerDaemons: codersdk.DeploymentConfigField[int]{
159+
Name: "Provisioner Daemons",
139160
Key: "provisioner.daemons",
140161
Usage: "Number of provisioner daemons to create on start. If builds are stuck in queued state for a long time, consider increasing this.",
141162
Flag: "provisioner-daemons",
142163
Value: 3,
143164
},
144165
PostgresURL: codersdk.DeploymentConfigField[string]{
166+
Name: "Postgres Connection URL",
145167
Key: "pg_connection_url",
146168
Usage: "URL of a PostgreSQL database. If empty, PostgreSQL binaries will be downloaded from Maven (https://repo1.maven.org/maven2) and store all data in the config root. Access the built-in database with \"coder server postgres-builtin-url\".",
147169
Flag: "postgres-url",
148170
},
149171
OAuth2GithubClientID: codersdk.DeploymentConfigField[string]{
172+
Name: "OAuth2 GitHub Client ID",
150173
Key: "oauth2.github.client_id",
151174
Usage: "Client ID for Login with GitHub.",
152175
Flag: "oauth2-github-client-id",
153176
},
154177
OAuth2GithubClientSecret: codersdk.DeploymentConfigField[string]{
178+
Name: "OAuth2 GitHub Client Secret",
155179
Key: "oauth2.github.client_secret",
156180
Usage: "Client secret for Login with GitHub.",
157181
Flag: "oauth2-github-client-secret",
158182
},
159183
OAuth2GithubAllowedOrgs: codersdk.DeploymentConfigField[[]string]{
184+
Name: "OAuth2 GitHub Allowed Orgs",
160185
Key: "oauth2.github.allowed_orgs",
161186
Usage: "Organizations the user must be a member of to Login with GitHub.",
162187
Flag: "oauth2-github-allowed-orgs",
163188
},
164189
OAuth2GithubAllowedTeams: codersdk.DeploymentConfigField[[]string]{
190+
Name: "OAuth2 GitHub Allowed Teams",
165191
Key: "oauth2.github.allowed_teams",
166192
Usage: "Teams inside organizations the user must be a member of to Login with GitHub. Structured as: <organization-name>/<team-slug>.",
167193
Flag: "oauth2-github-allowed-teams",
168194
},
169195
OAuth2GithubAllowSignups: codersdk.DeploymentConfigField[bool]{
196+
Name: "OAuth2 GitHub Allow Signups",
170197
Key: "oauth2.github.allow_signups",
171198
Usage: "Whether new users can sign up with GitHub.",
172199
Flag: "oauth2-github-allow-signups",
173200
},
174201
OAuth2GithubEnterpriseBaseURL: codersdk.DeploymentConfigField[string]{
202+
Name: "OAuth2 GitHub Enterprise Base URL",
175203
Key: "oauth2.github.enterprise_base_url",
176204
Usage: "Base URL of a GitHub Enterprise deployment to use for Login with GitHub.",
177205
Flag: "oauth2-github-enterprise-base-url",
178206
},
179207
OIDCAllowSignups: codersdk.DeploymentConfigField[bool]{
208+
Name: "OIDC Allow Signups",
180209
Key: "oidc.allow_signups",
181210
Usage: "Whether new users can sign up with OIDC.",
182211
Flag: "oidc-allow-signups",
183212
Value: true,
184213
},
185214
OIDCClientID: codersdk.DeploymentConfigField[string]{
215+
Name: "OIDC Client ID",
186216
Key: "oidc.client_id",
187217
Usage: "Client ID to use for Login with OIDC.",
188218
Flag: "oidc-client-id",
189219
},
190220
OIDCClientSecret: codersdk.DeploymentConfigField[string]{
221+
Name: "OIDC Client Secret",
191222
Key: "oidc.client_secret",
192223
Usage: "Client secret to use for Login with OIDC.",
193224
Flag: "oidc-client-secret",
194225
},
195226
OIDCEmailDomain: codersdk.DeploymentConfigField[string]{
227+
Name: "OIDC Email Domain",
196228
Key: "oidc.email_domain",
197229
Usage: "Email domain that clients logging in with OIDC must match.",
198230
Flag: "oidc-email-domain",
199231
},
200232
OIDCIssuerURL: codersdk.DeploymentConfigField[string]{
233+
Name: "OIDC Issuer URL",
201234
Key: "oidc.issuer_url",
202235
Usage: "Issuer URL to use for Login with OIDC.",
203236
Flag: "oidc-issuer-url",
204237
},
205238
OIDCScopes: codersdk.DeploymentConfigField[[]string]{
239+
Name: "OIDC Scopes",
206240
Key: "oidc.scopes",
207241
Usage: "Scopes to grant when authenticating with OIDC.",
208242
Flag: "oidc-scopes",
209243
Value: []string{oidc.ScopeOpenID, "profile", "email"},
210244
},
211245
TelemetryEnable: codersdk.DeploymentConfigField[bool]{
246+
Name: "Telemetry Enable",
212247
Key: "telemetry.enable",
213248
Usage: "Whether telemetry is enabled or not. Coder collects anonymized usage data to help improve our product.",
214249
Flag: "telemetry",
215250
Value: flag.Lookup("test.v") == nil,
216251
},
217252
TelemetryTrace: codersdk.DeploymentConfigField[bool]{
253+
Name: "Telemetry Trace",
218254
Key: "telemetry.trace",
219255
Usage: "Whether Opentelemetry traces are sent to Coder. Coder collects anonymized application tracing to help improve our product. Disabling telemetry also disables this option.",
220256
Flag: "telemetry-trace",
221257
Value: flag.Lookup("test.v") == nil,
222258
},
223259
TelemetryURL: codersdk.DeploymentConfigField[string]{
260+
Name: "Telemetry URL",
224261
Key: "telemetry.url",
225262
Usage: "URL to send telemetry.",
226263
Flag: "telemetry-url",
227264
Hidden: true,
228265
Value: "https://telemetry.coder.com",
229266
},
230267
TLSEnable: codersdk.DeploymentConfigField[bool]{
268+
Name: "TLS Enable",
231269
Key: "tls.enable",
232270
Usage: "Whether TLS will be enabled.",
233271
Flag: "tls-enable",
234272
},
235273
TLSCertFiles: codersdk.DeploymentConfigField[[]string]{
274+
Name: "TLS Certificate Files",
236275
Key: "tls.cert_file",
237276
Usage: "Path to each certificate for TLS. It requires a PEM-encoded file. To configure the listener to use a CA certificate, concatenate the primary certificate and the CA certificate together. The primary certificate should appear first in the combined file.",
238277
Flag: "tls-cert-file",
239278
},
240279
TLSClientCAFile: codersdk.DeploymentConfigField[string]{
280+
Name: "TLS Client CA Files",
241281
Key: "tls.client_ca_file",
242282
Usage: "PEM-encoded Certificate Authority file used for checking the authenticity of client",
243283
Flag: "tls-client-ca-file",
244284
},
245285
TLSClientAuth: codersdk.DeploymentConfigField[string]{
286+
Name: "TLS Client Auth",
246287
Key: "tls.client_auth",
247288
Usage: "Policy the server will follow for TLS Client Authentication. Accepted values are \"none\", \"request\", \"require-any\", \"verify-if-given\", or \"require-and-verify\".",
248289
Flag: "tls-client-auth",
249290
Value: "request",
250291
},
251292
TLSKeyFiles: codersdk.DeploymentConfigField[[]string]{
293+
Name: "TLS Key Files",
252294
Key: "tls.key_file",
253295
Usage: "Paths to the private keys for each of the certificates. It requires a PEM-encoded file.",
254296
Flag: "tls-key-file",
255297
},
256298
TLSMinVersion: codersdk.DeploymentConfigField[string]{
299+
Name: "TLS Minimum Version",
257300
Key: "tls.min_version",
258301
Usage: "Minimum supported version of TLS. Accepted values are \"tls10\", \"tls11\", \"tls12\" or \"tls13\"",
259302
Flag: "tls-min-version",
260303
Value: "tls12",
261304
},
262305
TraceEnable: codersdk.DeploymentConfigField[bool]{
306+
Name: "Trace Enable",
263307
Key: "trace",
264308
Usage: "Whether application tracing data is collected.",
265309
Flag: "trace",
266310
},
267311
SecureAuthCookie: codersdk.DeploymentConfigField[bool]{
312+
Name: "Secure Auth Cookie",
268313
Key: "secure_auth_cookie",
269314
Usage: "Controls if the 'Secure' property is set on browser session cookies.",
270315
Flag: "secure-auth-cookie",
271316
},
272317
SSHKeygenAlgorithm: codersdk.DeploymentConfigField[string]{
318+
Name: "SSH Keygen Algorithm",
273319
Key: "ssh_keygen_algorithm",
274320
Usage: "The algorithm to use for generating ssh keys. Accepted values are \"ed25519\", \"ecdsa\", or \"rsa4096\".",
275321
Flag: "ssh-keygen-algorithm",
276322
Value: "ed25519",
277323
},
278324
AutoImportTemplates: codersdk.DeploymentConfigField[[]string]{
325+
Name: "Auto Import Templates",
279326
Key: "auto_import_templates",
280327
Usage: "Templates to auto-import. Available auto-importable templates are: kubernetes",
281328
Flag: "auto-import-template",
282329
Hidden: true,
283330
},
284331
MetricsCacheRefreshInterval: codersdk.DeploymentConfigField[time.Duration]{
332+
Name: "Metrics Cache Refresh Interval",
285333
Key: "metrics_cache_refresh_interval",
286334
Usage: "How frequently metrics are refreshed",
287335
Flag: "metrics-cache-refresh-interval",
288336
Hidden: true,
289337
Value: time.Hour,
290338
},
291339
AgentStatRefreshInterval: codersdk.DeploymentConfigField[time.Duration]{
340+
Name: "Agent Stat Refresh Interval",
292341
Key: "agent_stat_refresh_interval",
293342
Usage: "How frequently agent stats are recorded",
294343
Flag: "agent-stats-refresh-interval",
295344
Hidden: true,
296345
Value: 10 * time.Minute,
297346
},
298347
AuditLogging: codersdk.DeploymentConfigField[bool]{
348+
Name: "Audit Logging",
299349
Key: "audit_logging",
300350
Usage: "Specifies whether audit logging is enabled.",
301351
Flag: "audit-logging",
302352
Value: true,
303353
Enterprise: true,
304354
},
305355
BrowserOnly: codersdk.DeploymentConfigField[bool]{
356+
Name: "Browser Only",
306357
Key: "browser_only",
307358
Usage: "Whether Coder only allows connections to workspaces via the browser.",
308359
Flag: "browser-only",
309360
Enterprise: true,
310361
},
311362
SCIMAPIKey: codersdk.DeploymentConfigField[string]{
363+
Name: "SCIM API Key",
312364
Key: "scim_api_key",
313365
Usage: "Enables SCIM and sets the authentication header for the built-in SCIM server. New users are automatically created with OIDC authentication.",
314366
Flag: "scim-auth-header",
315367
Enterprise: true,
316368
},
317369
UserWorkspaceQuota: codersdk.DeploymentConfigField[int]{
370+
Name: "User Workspace Quota",
318371
Key: "user_workspace_quota",
319372
Usage: "Enables and sets a limit on how many workspaces each user can create.",
320373
Flag: "user-workspace-quota",

codersdk/deploymentconfig.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ type Flaggable interface {
7272
}
7373

7474
type DeploymentConfigField[T Flaggable] struct {
75-
Key string `json:"key"`
75+
Key string `json:"key"`
76+
// Name appears in the deployment UI.
7677
Name string `json:"name"`
7778
Usage string `json:"usage"`
7879
Flag string `json:"flag"`

site/src/components/DeploySettingsLayout/OptionsTable.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const OptionsTable: React.FC<{ options: Partial<DeploymentConfig> }> = ({
3333
<TableRow key={option.flag}>
3434
<TableCell>
3535
<OptionName>{option.name}</OptionName>
36-
<OptionDescription>{option.description}</OptionDescription>
36+
<OptionDescription>{option.usage}</OptionDescription>
3737
</TableCell>
3838

3939
<TableCell>

site/src/pages/DeploySettingsPage/AuthSettingsPage.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const AuthSettingsPage: React.FC = () => {
4242
<OptionsTable
4343
options={{
4444
oidc_client_id: deploymentConfig.oidc_client_id,
45-
oidc_client_secret: deploymentConfig.oidc_client_secret,
4645
oidc_allow_signups: deploymentConfig.oidc_allow_signups,
4746
oidc_email_domain: deploymentConfig.oidc_email_domain,
4847
oidc_issuer_url: deploymentConfig.oidc_issuer_url,
@@ -70,8 +69,6 @@ const AuthSettingsPage: React.FC = () => {
7069
<OptionsTable
7170
options={{
7271
oauth2_github_client_id: deploymentConfig.oauth2_github_client_id,
73-
oauth2_github_client_secret:
74-
deploymentConfig.oauth2_github_client_secret,
7572
oauth2_github_allow_signups:
7673
deploymentConfig.oauth2_github_allow_signups,
7774
oauth2_github_allowed_orgs:

0 commit comments

Comments
 (0)