Skip to content

Commit 1c895d3

Browse files
committed
Amen PR comment, name the padding
1 parent 5fd8657 commit 1c895d3

File tree

8 files changed

+27
-24
lines changed

8 files changed

+27
-24
lines changed

coderd/database/databasefake/databasefake.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,7 @@ func (q *fakeQuerier) UpdateTemplateMetaByID(_ context.Context, arg database.Upd
14551455
tpl.Name = arg.Name
14561456
tpl.Description = arg.Description
14571457
tpl.Icon = arg.Icon
1458-
tpl.DefaultTtl = arg.DefaultTtl
1458+
tpl.DefaultTTL = arg.DefaultTTL
14591459
q.templates[idx] = tpl
14601460
return tpl, nil
14611461
}
@@ -2236,7 +2236,7 @@ func (q *fakeQuerier) InsertTemplate(_ context.Context, arg database.InsertTempl
22362236
Provisioner: arg.Provisioner,
22372237
ActiveVersionID: arg.ActiveVersionID,
22382238
Description: arg.Description,
2239-
DefaultTtl: arg.DefaultTtl,
2239+
DefaultTTL: arg.DefaultTTL,
22402240
CreatedBy: arg.CreatedBy,
22412241
UserACL: arg.UserACL,
22422242
GroupACL: arg.GroupACL,

coderd/database/models.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/sqlc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ rename:
4848
user_acl: UserACL
4949
group_acl: GroupACL
5050
troubleshooting_url: TroubleshootingURL
51+
default_ttl: DefaultTTL

coderd/templates.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ func (api *API) postTemplateByOrganization(rw http.ResponseWriter, r *http.Reque
233233
Provisioner: importJob.Provisioner,
234234
ActiveVersionID: templateVersion.ID,
235235
Description: createTemplate.Description,
236-
DefaultTtl: int64(ttl),
236+
DefaultTTL: int64(ttl),
237237
CreatedBy: apiKey.UserID,
238238
UserACL: database.TemplateACL{},
239239
GroupACL: database.TemplateACL{
@@ -473,7 +473,7 @@ func (api *API) patchTemplateMeta(rw http.ResponseWriter, r *http.Request) {
473473
if req.Name == template.Name &&
474474
req.Description == template.Description &&
475475
req.Icon == template.Icon &&
476-
req.DefaultTTLMillis == time.Duration(template.DefaultTtl).Milliseconds() {
476+
req.DefaultTTLMillis == time.Duration(template.DefaultTTL).Milliseconds() {
477477
return nil
478478
}
479479

@@ -496,7 +496,7 @@ func (api *API) patchTemplateMeta(rw http.ResponseWriter, r *http.Request) {
496496
Name: name,
497497
Description: desc,
498498
Icon: icon,
499-
DefaultTtl: int64(maxTTL),
499+
DefaultTTL: int64(maxTTL),
500500
})
501501
if err != nil {
502502
return err
@@ -640,7 +640,7 @@ func (api *API) autoImportTemplate(ctx context.Context, opts autoImportTemplateO
640640
Provisioner: job.Provisioner,
641641
ActiveVersionID: templateVersion.ID,
642642
Description: "This template was auto-imported by Coder.",
643-
DefaultTtl: 0,
643+
DefaultTTL: 0,
644644
CreatedBy: opts.userID,
645645
UserACL: database.TemplateACL{},
646646
GroupACL: database.TemplateACL{
@@ -745,7 +745,7 @@ func (api *API) convertTemplate(
745745
BuildTimeStats: buildTimeStats,
746746
Description: template.Description,
747747
Icon: template.Icon,
748-
DefaultTTLMillis: time.Duration(template.DefaultTtl).Milliseconds(),
748+
DefaultTTLMillis: time.Duration(template.DefaultTTL).Milliseconds(),
749749
CreatedByID: template.CreatedBy,
750750
CreatedByName: createdByName,
751751
}

coderd/workspaces.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func (api *API) postWorkspacesByOrganization(rw http.ResponseWriter, r *http.Req
341341
return
342342
}
343343

344-
dbTTL, err := validWorkspaceTTLMillis(createWorkspace.TTLMillis, template.DefaultTtl)
344+
dbTTL, err := validWorkspaceTTLMillis(createWorkspace.TTLMillis, template.DefaultTTL)
345345
if err != nil {
346346
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
347347
Message: "Invalid Workspace Time to Shutdown.",
@@ -729,7 +729,7 @@ func (api *API) putWorkspaceTTL(rw http.ResponseWriter, r *http.Request) {
729729
return xerrors.Errorf("fetch workspace template: %w", err)
730730
}
731731

732-
dbTTL, err = validWorkspaceTTLMillis(req.TTLMillis, template.DefaultTtl)
732+
dbTTL, err = validWorkspaceTTLMillis(req.TTLMillis, template.DefaultTTL)
733733
if err != nil {
734734
return codersdk.ValidationError{Field: "ttl_ms", Detail: err.Error()}
735735
}

enterprise/audit/diff_internal_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ func Test_diff(t *testing.T) {
250250
Name: "rust",
251251
Provisioner: database.ProvisionerTypeTerraform,
252252
ActiveVersionID: uuid.UUID{3},
253-
DefaultTtl: int64(time.Hour),
253+
DefaultTTL: int64(time.Hour),
254254
CreatedBy: uuid.UUID{4},
255255
},
256256
exp: audit.Map{

scripts/develop.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,17 @@ CODER_DEV_SHIM="${PROJECT_ROOT}/scripts/coder-dev.sh"
118118
interfaces+=($(ifconfig | awk '/inet / {print $2}'))
119119
fi
120120

121+
# Space padding used after the URLs to align "==".
122+
space_padding=26
121123
log
122124
log "===================================================================="
123125
log "== =="
124126
log "== Coder is now running in development mode. =="
125127
for iface in "${interfaces[@]}"; do
126-
log "$(printf "== API: http://%s:3000%$((26 - ${#iface}))s==" "$iface" "")"
128+
log "$(printf "== API: http://%s:3000%$((space_padding - ${#iface}))s==" "$iface" "")"
127129
done
128130
for iface in "${interfaces[@]}"; do
129-
log "$(printf "== Web UI: http://%s:8080%$((26 - ${#iface}))s==" "$iface" "")"
131+
log "$(printf "== Web UI: http://%s:8080%$((space_padding - ${#iface}))s==" "$iface" "")"
130132
done
131133
log "== =="
132134
log "== Use ./scripts/coder-dev.sh to talk to this instance! =="

0 commit comments

Comments
 (0)