Skip to content

Commit

Permalink
feat: add ability to load env vars via environment
Browse files Browse the repository at this point in the history
Signed-off-by: loganprice <Logan.B.Price@gmail.com>
  • Loading branch information
loganprice committed Sep 9, 2021
1 parent 1101b35 commit 81d4831
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 8 additions & 0 deletions pkg/cidata/cidata.TEMPLATE.d/boot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ WARNING() {
# shellcheck disable=SC2163
while read -r line; do export "$line"; done <"${LIMA_CIDATA_MNT}"/lima.env

sed -i '/#LIMA-START/,/#LIMA-END/d' /etc/environment
cat "${LIMA_CIDATA_MNT}/lima.environment" >>/etc/environment

# shellcheck disable=SC2163
while read -r line; do
[ "$(expr "$line" : '#')" -eq 0 ] && export "$line"
done <"${LIMA_CIDATA_MNT}"/lima.environment

CODE=0

for f in "${LIMA_CIDATA_MNT}"/boot/*; do
Expand Down
3 changes: 0 additions & 3 deletions pkg/cidata/cidata.TEMPLATE.d/lima.env
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,3 @@ LIMA_CIDATA_CONTAINERD_SYSTEM=1
LIMA_CIDATA_CONTAINERD_SYSTEM=
{{- end}}
LIMA_CIDATA_SLIRP_GATEWAY={{ .SlirpGateway }}
{{- range $key, $val := .Env}}
{{$key}}={{$val}}
{{- end}}
5 changes: 5 additions & 0 deletions pkg/cidata/cidata.TEMPLATE.d/lima.environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#LIMA-START
{{- range $key, $val := .Env}}
{{$key}}={{$val}}
{{- end}}
#LIMA-END

0 comments on commit 81d4831

Please sign in to comment.