Skip to content

Commit deccdaf

Browse files
authored
Merge pull request #195 from loganprice/envVars
2 parents 2749877 + 8920472 commit deccdaf

File tree

5 files changed

+26
-14
lines changed

5 files changed

+26
-14
lines changed

pkg/cidata/cidata.TEMPLATE.d/lima.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ LIMA_CIDATA_CONTAINERD_SYSTEM=1
1515
LIMA_CIDATA_CONTAINERD_SYSTEM=
1616
{{- end}}
1717
LIMA_CIDATA_SLIRP_GATEWAY={{ .SlirpGateway }}
18+
{{- range $key, $val := .Env}}
19+
{{$key}}={{$val}}
20+
{{- end}}

pkg/cidata/cidata.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML) error {
5252
UID: uid,
5353
Containerd: Containerd{System: *y.Containerd.System, User: *y.Containerd.User},
5454
SlirpGateway: qemuconst.SlirpGateway,
55+
Env: y.Env,
5556
}
5657

5758
pubKeys, err := sshutil.DefaultPubKeys(*y.SSH.LoadDotSSHPubKeys)

pkg/cidata/template.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type TemplateArgs struct {
3636
Containerd Containerd
3737
Networks []Network
3838
SlirpGateway string
39+
Env map[string]*string
3940
}
4041

4142
func ValidateTemplateArgs(args TemplateArgs) error {

pkg/limayaml/default.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ ssh:
5757
# Default: true
5858
loadDotSSHPubKeys: true
5959

60+
61+
6062
# ===================================================================== #
6163
# ADVANCED CONFIGURATION
6264
# ===================================================================== #
@@ -163,6 +165,10 @@ network:
163165
# hostPortRange: [1024, 65535]
164166
# # Any port still not matched by a rule will not be forwarded (ignored)
165167

168+
# # extra environment variables that will be loaded into the VM at start up
169+
# env:
170+
# KEY: value
171+
166172
# ===================================================================== #
167173
# END OF TEMPLATE
168174
# ===================================================================== #

pkg/limayaml/limayaml.go

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,21 @@ import (
77
)
88

99
type LimaYAML struct {
10-
Arch Arch `yaml:"arch,omitempty"`
11-
Images []File `yaml:"images"` // REQUIRED
12-
CPUs int `yaml:"cpus,omitempty"`
13-
Memory string `yaml:"memory,omitempty"` // go-units.RAMInBytes
14-
Disk string `yaml:"disk,omitempty"` // go-units.RAMInBytes
15-
Mounts []Mount `yaml:"mounts,omitempty"`
16-
SSH SSH `yaml:"ssh,omitempty"` // REQUIRED (FIXME)
17-
Firmware Firmware `yaml:"firmware,omitempty"`
18-
Video Video `yaml:"video,omitempty"`
19-
Provision []Provision `yaml:"provision,omitempty"`
20-
Containerd Containerd `yaml:"containerd,omitempty"`
21-
Probes []Probe `yaml:"probes,omitempty"`
22-
PortForwards []PortForward `yaml:"portForwards,omitempty"`
23-
Network Network `yaml:"network,omitempty"`
10+
Arch Arch `yaml:"arch,omitempty"`
11+
Images []File `yaml:"images"` // REQUIRED
12+
CPUs int `yaml:"cpus,omitempty"`
13+
Memory string `yaml:"memory,omitempty"` // go-units.RAMInBytes
14+
Disk string `yaml:"disk,omitempty"` // go-units.RAMInBytes
15+
Mounts []Mount `yaml:"mounts,omitempty"`
16+
SSH SSH `yaml:"ssh,omitempty"` // REQUIRED (FIXME)
17+
Firmware Firmware `yaml:"firmware,omitempty"`
18+
Video Video `yaml:"video,omitempty"`
19+
Provision []Provision `yaml:"provision,omitempty"`
20+
Containerd Containerd `yaml:"containerd,omitempty"`
21+
Probes []Probe `yaml:"probes,omitempty"`
22+
PortForwards []PortForward `yaml:"portForwards,omitempty"`
23+
Network Network `yaml:"network,omitempty"`
24+
Env map[string]*string `yaml:"env,omitempty"`
2425
}
2526

2627
type Arch = string

0 commit comments

Comments
 (0)