mirror of
https://github.com/dnlbauer/dotfiles.git
synced 2026-09-10 13:35:30 +00:00
feat: set ephemeral flag inside containers
This commit is contained in:
@@ -1,5 +1,19 @@
|
||||
{{- $github_email := promptStringOnce . "github_email" "Github Email address" -}}
|
||||
{{- $machineClass := promptChoiceOnce . "machineClass" "Machine class (private/server/public)" (list "private" "server" "public") -}}
|
||||
# Check if this runs in an ephemeral container, e.g. builder, devcontainer, etc.
|
||||
{{- $ephemeralOverride := env "CHEZMOI_EPHEMERAL" -}}
|
||||
{{- $ephemeral := or (eq $ephemeralOverride "1") (eq $ephemeralOverride "true") -}}
|
||||
{{- if not $ephemeralOverride -}}
|
||||
{{- $ephemeral = or (not stdinIsATTY) (ne (env "CODESPACES") "") (eq .chezmoi.username "vscode") -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $github_email := "" -}}
|
||||
{{- $machineClass := "" -}}
|
||||
{{- if $ephemeral -}}
|
||||
{{- $github_email = env "CHEZMOI_GITHUB_EMAIL" -}}
|
||||
{{- $machineClass = env "CHEZMOI_MACHINE_CLASS" | default "public" -}}
|
||||
{{- else -}}
|
||||
{{- $github_email = promptStringOnce . "github_email" "Github Email address" -}}
|
||||
{{- $machineClass = promptChoiceOnce . "machineClass" "Machine class (private/server/public)" (list "private" "server" "public") -}}
|
||||
{{- end -}}
|
||||
|
||||
encryption = "age"
|
||||
[age]
|
||||
@@ -9,4 +23,4 @@ encryption = "age"
|
||||
[data]
|
||||
github_email = {{ $github_email | quote }}
|
||||
machineClass = {{ $machineClass | quote }}
|
||||
ephemeral = {{ $ephemeral }}
|
||||
ephemeral = {{ $ephemeral }}
|
||||
Reference in New Issue
Block a user