infisical
infisical copied to clipboard
Pass in values from flags as template values to export --template mechanism
Feature description
Using the export
--template
feature, it would be great if I could pass in the values for projectId
, environmentSlug
, and folderPath
as values from the flags called on the export command as opposed to only being able to specify those within the template file itself. Ideally I could specify in the file something like this...
{{$secrets := secret "$flags.projectId" "$flags.env" "$flags.path"}}
{{$length := len $secrets}}
{{- "{"}}
{{- with $secrets }}
{{- range $index, $secret := . }}
"{{ $secret.Key }}": "{{ $secret.Value }}"{{if lt $index (minus $length 1)}},{{end}}
{{- end }}
{{- end }}
{{ "}" -}}
And those would get pulled from the export call if I had something like infisical export --template="/some/template/file" --projectId=some-uuid --env=dev --path="/api"
Why would it be useful?
This would be specifically helpful for use with CI as often the values for those are pulled from something like Github secrets.
Additional context
Currently the way to do something like this using a template that you need the values to be pulled from CI would be to either write the file each time using CI steps, or have multiple files that you simple hard code the values into and have CI specify a different path for the template depending on the need.