MCPcopy Create free account
hub / github.com/coder/envbuilder / SetDefaults

Method SetDefaults

options/defaults.go:40–74  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40func (o *Options) SetDefaults() {
41 // Temporarily removed these from the default settings to prevent conflicts
42 // between current and legacy environment variables that add default values.
43 // Once the legacy environment variables are phased out, this can be
44 // reinstated to the previous default values.
45 if len(o.IgnorePaths) == 0 {
46 o.IgnorePaths = []string{
47 "/var/run",
48 // KinD adds these paths to pods, so ignore them by default.
49 "/product_uuid", "/product_name",
50 }
51 }
52 if o.InitScript == "" {
53 o.InitScript = "sleep infinity"
54 }
55 if o.InitCommand == "" {
56 o.InitCommand = "/bin/sh"
57 }
58
59 if o.Filesystem == nil {
60 o.Filesystem = chmodfs.New(osfs.New("/"))
61 }
62 if o.WorkspaceBaseDir == "" {
63 o.WorkspaceBaseDir = "/workspaces"
64 }
65 if o.WorkspaceFolder == "" {
66 o.WorkspaceFolder = DefaultWorkspaceFolder(o.WorkspaceBaseDir, o.GitURL)
67 }
68 if o.BinaryPath == "" {
69 o.BinaryPath = "/.envbuilder/bin/envbuilder"
70 }
71 if o.WorkingDirBase == "" {
72 o.WorkingDirBase = workingdir.Default.Path()
73 }
74}

Callers 2

TestOptions_SetDefaultsFunction · 0.95
envbuilderCmdFunction · 0.95

Calls 3

NewFunction · 0.92
DefaultWorkspaceFolderFunction · 0.85
PathMethod · 0.80

Tested by 1

TestOptions_SetDefaultsFunction · 0.76