Skip to content

Commit 6e04433

Browse files
committed
replace hardcoded labs directory with defaultLabsDir constant
1 parent 7d533b8 commit 6e04433

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

cmd/tools_api_start.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func apiServerStart(cobraCmd *cobra.Command, o *Options) error { //nolint: funle
228228

229229
// Create container labels
230230
if o.ToolsAPI.LabsDirectory == "" {
231-
o.ToolsAPI.LabsDirectory = "~/.clab"
231+
o.ToolsAPI.LabsDirectory = defaultLabsDir
232232
}
233233

234234
owner := getOwnerName(o)

cmd/tools_api_status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func apiServerStatus(cobraCmd *cobra.Command, o *Options) error {
7979
}
8080

8181
// Get labs dir from labels or use default
82-
labsDir := "~/.clab" // default
82+
labsDir := defaultLabsDir // default
8383
if dirsVal, ok := containers[idx].Labels["clab-labs-dir"]; ok {
8484
labsDir = dirsVal
8585
}

cmd/tools_code_server.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const (
2929
codeServerDirPerm = 0o755
3030
codeServerConfigPerm = 0o644
3131
codeServerMarkerName = ".initialized"
32+
defaultLabsDir = "~/.clab"
3233
)
3334

3435
type codeServerPaths struct {
@@ -387,7 +388,7 @@ func codeServerStart(cobraCmd *cobra.Command, o *Options) error {
387388

388389
// Create container labels
389390
if o.ToolsCodeServer.LabsDirectory == "" {
390-
o.ToolsCodeServer.LabsDirectory = "~/.clab"
391+
o.ToolsCodeServer.LabsDirectory = defaultLabsDir
391392
}
392393

393394
owner := getOwnerName(o)
@@ -507,7 +508,7 @@ func codeServerStatus(cobraCmd *cobra.Command, o *Options) error {
507508
port := containers[idx].Ports[0].HostPort
508509

509510
// Get labs dir from labels or use default
510-
labsDir := "~/.clab" // default
511+
labsDir := defaultLabsDir // default
511512
if dirsVal, ok := containers[idx].Labels["clab-labs-dir"]; ok {
512513
labsDir = dirsVal
513514
}

0 commit comments

Comments
 (0)