@@ -832,16 +832,16 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
832
832
833
833
// Coder tracing should be disabled if telemetry is disabled unless
834
834
// --telemetry-trace was explicitly provided.
835
- shouldCoderTrace := bool (cfg .Telemetry .Enable .Bool ()) && ! isTest ()
835
+ shouldCoderTrace := bool (cfg .Telemetry .Enable .Value ()) && ! isTest ()
836
836
// Only override if telemetryTraceEnable was specifically set.
837
837
// By default we want it to be controlled by telemetryEnable.
838
838
if cmd .Flags ().Changed ("telemetry-trace" ) {
839
- shouldCoderTrace = cfg .Telemetry .Trace .Bool ()
839
+ shouldCoderTrace = cfg .Telemetry .Trace .Value ()
840
840
}
841
841
842
- if cfg .Trace .Enable .Bool () || shouldCoderTrace || cfg .Trace .HoneycombAPIKey != "" {
842
+ if cfg .Trace .Enable .Value () || shouldCoderTrace || cfg .Trace .HoneycombAPIKey != "" {
843
843
sdkTracerProvider , closeTracing , err := tracing .TracerProvider (ctx , "coderd" , tracing.TracerOpts {
844
- Default : cfg .Trace .Enable .Bool (),
844
+ Default : cfg .Trace .Enable .Value (),
845
845
Coder : shouldCoderTrace ,
846
846
Honeycomb : cfg .Trace .HoneycombAPIKey .String (),
847
847
})
@@ -1064,7 +1064,7 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1064
1064
}
1065
1065
1066
1066
// Warn the user if the access URL appears to be a loopback address.
1067
- isLocal , err := isLocalURL (ctx , cfg .AccessURL .URL ())
1067
+ isLocal , err := isLocalURL (ctx , cfg .AccessURL .Value ())
1068
1068
if isLocal || err != nil {
1069
1069
reason := "could not be resolved"
1070
1070
if isLocal {
@@ -1092,12 +1092,12 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1092
1092
1093
1093
defaultRegion := & tailcfg.DERPRegion {
1094
1094
EmbeddedRelay : true ,
1095
- RegionID : cfg .DERP .Server .RegionID .Int ( ),
1095
+ RegionID : int ( cfg .DERP .Server .RegionID .Value () ),
1096
1096
RegionCode : cfg .DERP .Server .RegionCode .String (),
1097
1097
RegionName : cfg .DERP .Server .RegionName .String (),
1098
1098
Nodes : []* tailcfg.DERPNode {{
1099
1099
Name : fmt .Sprintf ("%db" , cfg .DERP .Server .RegionID ),
1100
- RegionID : cfg .DERP .Server .RegionID .Int ( ),
1100
+ RegionID : int ( cfg .DERP .Server .RegionID .Value () ),
1101
1101
HostName : cfg .AccessURL .Host ,
1102
1102
DERPPort : accessURLPort ,
1103
1103
STUNPort : - 1 ,
@@ -1130,7 +1130,7 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1130
1130
}
1131
1131
1132
1132
options := & coderd.Options {
1133
- AccessURL : cfg .AccessURL .URL (),
1133
+ AccessURL : cfg .AccessURL .Value (),
1134
1134
AppHostname : appHostname ,
1135
1135
AppHostnameRegex : appHostnameRegex ,
1136
1136
Logger : logger .Named ("coderd" ),
@@ -1141,15 +1141,15 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1141
1141
GoogleTokenValidator : googleTokenValidator ,
1142
1142
// GitAuthConfigs: gitAuthConfigs,
1143
1143
RealIPConfig : realIPConfig ,
1144
- SecureAuthCookie : cfg .SecureAuthCookie .Bool (),
1144
+ SecureAuthCookie : cfg .SecureAuthCookie .Value (),
1145
1145
SSHKeygenAlgorithm : sshKeygenAlgorithm ,
1146
1146
TracerProvider : tracerProvider ,
1147
1147
Telemetry : telemetry .NewNoop (),
1148
- MetricsCacheRefreshInterval : cfg .MetricsCacheRefreshInterval .Duration (),
1149
- AgentStatsRefreshInterval : cfg .AgentStatRefreshInterval .Duration (),
1148
+ MetricsCacheRefreshInterval : cfg .MetricsCacheRefreshInterval .Value (),
1149
+ AgentStatsRefreshInterval : cfg .AgentStatRefreshInterval .Value (),
1150
1150
DeploymentConfig : cfg ,
1151
1151
PrometheusRegistry : prometheus .NewRegistry (),
1152
- APIRateLimit : cfg .RateLimit .API .Int ( ),
1152
+ APIRateLimit : int ( cfg .RateLimit .API .Value () ),
1153
1153
LoginRateLimit : loginRateLimit ,
1154
1154
FilesRateLimit : filesRateLimit ,
1155
1155
HTTPClient : httpClient ,
@@ -1160,7 +1160,7 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1160
1160
1161
1161
if cfg .StrictTransportSecurity > 0 {
1162
1162
options .StrictTransportSecurityCfg , err = httpmw .HSTSConfigOptions (
1163
- cfg .StrictTransportSecurity .Int ( ), cfg .StrictTransportSecurityOptions ,
1163
+ int ( cfg .StrictTransportSecurity .Value () ), cfg .StrictTransportSecurityOptions ,
1164
1164
)
1165
1165
if err != nil {
1166
1166
return xerrors .Errorf ("coderd: setting hsts header failed (options: %v): %w" , cfg .StrictTransportSecurityOptions , err )
@@ -1187,11 +1187,11 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1187
1187
}
1188
1188
1189
1189
if cfg .OAuth2 .Github .ClientSecret != "" {
1190
- options .GithubOAuth2Config , err = configureGithubOAuth2 (cfg .AccessURL .URL (),
1190
+ options .GithubOAuth2Config , err = configureGithubOAuth2 (cfg .AccessURL .Value (),
1191
1191
cfg .OAuth2 .Github .ClientID .String (),
1192
1192
cfg .OAuth2 .Github .ClientSecret .String (),
1193
- cfg .OAuth2 .Github .AllowSignups .Bool (),
1194
- cfg .OAuth2 .Github .AllowEveryone .Bool (),
1193
+ cfg .OAuth2 .Github .AllowSignups .Value (),
1194
+ cfg .OAuth2 .Github .AllowEveryone .Value (),
1195
1195
cfg .OAuth2 .Github .AllowedOrgs ,
1196
1196
cfg .OAuth2 .Github .AllowedTeams ,
1197
1197
cfg .OAuth2 .Github .EnterpriseBaseURL .String (),
@@ -1219,7 +1219,7 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1219
1219
if err != nil {
1220
1220
return xerrors .Errorf ("configure oidc provider: %w" , err )
1221
1221
}
1222
- redirectURL , err := cfg .AccessURL .URL ().Parse ("/api/v2/users/oidc/callback" )
1222
+ redirectURL , err := cfg .AccessURL .Value ().Parse ("/api/v2/users/oidc/callback" )
1223
1223
if err != nil {
1224
1224
return xerrors .Errorf ("parse oidc oauth callback url: %w" , err )
1225
1225
}
@@ -1236,11 +1236,11 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1236
1236
ClientID : cfg .OIDC .ClientID .String (),
1237
1237
}),
1238
1238
EmailDomain : cfg .OIDC .EmailDomain ,
1239
- AllowSignups : cfg .OIDC .AllowSignups .Bool (),
1239
+ AllowSignups : cfg .OIDC .AllowSignups .Value (),
1240
1240
UsernameField : cfg .OIDC .UsernameField .String (),
1241
1241
SignInText : cfg .OIDC .SignInText .String (),
1242
1242
IconURL : cfg .OIDC .IconURL .String (),
1243
- IgnoreEmailVerified : cfg .OIDC .IgnoreEmailVerified .Bool (),
1243
+ IgnoreEmailVerified : cfg .OIDC .IgnoreEmailVerified .Value (),
1244
1244
}
1245
1245
}
1246
1246
@@ -1294,14 +1294,14 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1294
1294
DeploymentID : deploymentID ,
1295
1295
Database : options .Database ,
1296
1296
Logger : logger .Named ("telemetry" ),
1297
- URL : cfg .Telemetry .URL .URL (),
1297
+ URL : cfg .Telemetry .URL .Value (),
1298
1298
Wildcard : cfg .WildcardAccessURL .String () != "" ,
1299
1299
DERPServerRelayURL : cfg .DERP .Server .RelayURL .String (),
1300
1300
GitAuth : gitAuth ,
1301
1301
GitHubOAuth : cfg .OAuth2 .Github .ClientID != "" ,
1302
1302
OIDCAuth : cfg .OIDC .ClientID != "" ,
1303
1303
OIDCIssuerURL : cfg .OIDC .IssuerURL .String (),
1304
- Prometheus : cfg .Prometheus .Enable .Bool (),
1304
+ Prometheus : cfg .Prometheus .Enable .Value (),
1305
1305
STUN : len (cfg .DERP .Server .STUNAddresses ) != 0 ,
1306
1306
Tunnel : tunnel != nil ,
1307
1307
})
@@ -1340,7 +1340,7 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1340
1340
}
1341
1341
1342
1342
if cfg .Swagger .Enable {
1343
- options .SwaggerEndpoint = cfg .Swagger .Enable .Bool ()
1343
+ options .SwaggerEndpoint = cfg .Swagger .Enable .Value ()
1344
1344
}
1345
1345
1346
1346
// We use a separate coderAPICloser so the Enterprise API
@@ -1384,7 +1384,7 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1384
1384
}
1385
1385
}()
1386
1386
provisionerdMetrics := provisionerd .NewMetrics (options .PrometheusRegistry )
1387
- for i := 0 ; i < cfg .Provisioner .Daemons .Int (); i ++ {
1387
+ for i := int64 ( 0 ) ; i < cfg .Provisioner .Daemons .Value (); i ++ {
1388
1388
daemonCacheDir := filepath .Join (cacheDir , fmt .Sprintf ("provisioner-%d" , i ))
1389
1389
daemon , err := newProvisionerDaemon (ctx , coderAPI , provisionerdMetrics , logger , cfg , daemonCacheDir , errCh , false )
1390
1390
if err != nil {
@@ -1400,7 +1400,7 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1400
1400
// the request is not to a local IP.
1401
1401
var handler http.Handler = coderAPI .RootHandler
1402
1402
if cfg .RedirectToAccessURL {
1403
- handler = redirectToAccessURL (handler , cfg .AccessURL .URL (), tunnel != nil , appHostnameRegex )
1403
+ handler = redirectToAccessURL (handler , cfg .AccessURL .Value (), tunnel != nil , appHostnameRegex )
1404
1404
}
1405
1405
1406
1406
// ReadHeaderTimeout is purposefully not enabled. It caused some
@@ -1478,7 +1478,7 @@ func Server(newAPI func(context.Context, *coderd.Options) (*coderd.API, io.Close
1478
1478
return xerrors .Errorf ("notify systemd: %w" , err )
1479
1479
}
1480
1480
1481
- autobuildPoller := time .NewTicker (cfg .AutobuildPollInterval .Duration ())
1481
+ autobuildPoller := time .NewTicker (cfg .AutobuildPollInterval .Value ())
1482
1482
defer autobuildPoller .Stop ()
1483
1483
autobuildExecutor := executor .New (ctx , options .Database , logger , autobuildPoller .C )
1484
1484
autobuildExecutor .Run ()
@@ -1765,11 +1765,11 @@ func newProvisionerDaemon(
1765
1765
return coderAPI .CreateInMemoryProvisionerDaemon (ctx , debounce )
1766
1766
}, & provisionerd.Options {
1767
1767
Logger : logger ,
1768
- JobPollInterval : cfg .Provisioner .DaemonPollInterval .Duration (),
1769
- JobPollJitter : cfg .Provisioner .DaemonPollJitter .Duration (),
1768
+ JobPollInterval : cfg .Provisioner .DaemonPollInterval .Value (),
1769
+ JobPollJitter : cfg .Provisioner .DaemonPollJitter .Value (),
1770
1770
JobPollDebounce : debounce ,
1771
1771
UpdateInterval : 500 * time .Millisecond ,
1772
- ForceCancelInterval : cfg .Provisioner .ForceCancelInterval .Duration (),
1772
+ ForceCancelInterval : cfg .Provisioner .ForceCancelInterval .Value (),
1773
1773
Provisioners : provisioners ,
1774
1774
WorkDirectory : tempDir ,
1775
1775
TracerProvider : coderAPI .TracerProvider ,
0 commit comments