Skip to content

Commit

Permalink
Merge pull request #195 from loganprice/envVars
Browse files Browse the repository at this point in the history
  • Loading branch information
AkihiroSuda authored Sep 4, 2021
2 parents 2749877 + 8920472 commit deccdaf
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
3 changes: 3 additions & 0 deletions pkg/cidata/cidata.TEMPLATE.d/lima.env
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ LIMA_CIDATA_CONTAINERD_SYSTEM=1
LIMA_CIDATA_CONTAINERD_SYSTEM=
{{- end}}
LIMA_CIDATA_SLIRP_GATEWAY={{ .SlirpGateway }}
{{- range $key, $val := .Env}}
{{$key}}={{$val}}
{{- end}}
1 change: 1 addition & 0 deletions pkg/cidata/cidata.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func GenerateISO9660(instDir, name string, y *limayaml.LimaYAML) error {
UID: uid,
Containerd: Containerd{System: *y.Containerd.System, User: *y.Containerd.User},
SlirpGateway: qemuconst.SlirpGateway,
Env: y.Env,
}

pubKeys, err := sshutil.DefaultPubKeys(*y.SSH.LoadDotSSHPubKeys)
Expand Down
1 change: 1 addition & 0 deletions pkg/cidata/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type TemplateArgs struct {
Containerd Containerd
Networks []Network
SlirpGateway string
Env map[string]*string
}

func ValidateTemplateArgs(args TemplateArgs) error {
Expand Down
6 changes: 6 additions & 0 deletions pkg/limayaml/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ ssh:
# Default: true
loadDotSSHPubKeys: true



# ===================================================================== #
# ADVANCED CONFIGURATION
# ===================================================================== #
Expand Down Expand Up @@ -163,6 +165,10 @@ network:
# hostPortRange: [1024, 65535]
# # Any port still not matched by a rule will not be forwarded (ignored)

# # extra environment variables that will be loaded into the VM at start up
# env:
# KEY: value

# ===================================================================== #
# END OF TEMPLATE
# ===================================================================== #
Expand Down
29 changes: 15 additions & 14 deletions pkg/limayaml/limayaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@ import (
)

type LimaYAML struct {
Arch Arch `yaml:"arch,omitempty"`
Images []File `yaml:"images"` // REQUIRED
CPUs int `yaml:"cpus,omitempty"`
Memory string `yaml:"memory,omitempty"` // go-units.RAMInBytes
Disk string `yaml:"disk,omitempty"` // go-units.RAMInBytes
Mounts []Mount `yaml:"mounts,omitempty"`
SSH SSH `yaml:"ssh,omitempty"` // REQUIRED (FIXME)
Firmware Firmware `yaml:"firmware,omitempty"`
Video Video `yaml:"video,omitempty"`
Provision []Provision `yaml:"provision,omitempty"`
Containerd Containerd `yaml:"containerd,omitempty"`
Probes []Probe `yaml:"probes,omitempty"`
PortForwards []PortForward `yaml:"portForwards,omitempty"`
Network Network `yaml:"network,omitempty"`
Arch Arch `yaml:"arch,omitempty"`
Images []File `yaml:"images"` // REQUIRED
CPUs int `yaml:"cpus,omitempty"`
Memory string `yaml:"memory,omitempty"` // go-units.RAMInBytes
Disk string `yaml:"disk,omitempty"` // go-units.RAMInBytes
Mounts []Mount `yaml:"mounts,omitempty"`
SSH SSH `yaml:"ssh,omitempty"` // REQUIRED (FIXME)
Firmware Firmware `yaml:"firmware,omitempty"`
Video Video `yaml:"video,omitempty"`
Provision []Provision `yaml:"provision,omitempty"`
Containerd Containerd `yaml:"containerd,omitempty"`
Probes []Probe `yaml:"probes,omitempty"`
PortForwards []PortForward `yaml:"portForwards,omitempty"`
Network Network `yaml:"network,omitempty"`
Env map[string]*string `yaml:"env,omitempty"`
}

type Arch = string
Expand Down

0 comments on commit deccdaf

Please sign in to comment.