Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: added export dotenv-plain #3074

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

micahco
Copy link

@micahco micahco commented Feb 1, 2025

Description 📣

This PR adds a new format option to the CLI: infisical export -f dotenv-plain.

The default dotenv format wraps the values in singles quotes (KEY='value') which can cause issues when feeding secrets from Infisical into a Docker container using the --env-file flag of docker run command. For example, when running the bluenviron/mediamtx container, I received the following error message (notice the extraneous single quotes wrapping the value):

$ docker run --rm -it --network=host --env-file <(infisical export) bluenviron/mediamtx
ERR: invalid source: ''rtsp://server/mystream''

Currently, I am using the --template flag to workaround this issue:

$ docker run --rm -it --network=host --env-file <(infisical export --template="/path/to/template/file") bluenviron/mediamtx

my-template-file:

{{$secrets := secret "<infisical-project-id>" "<environment-slug>" "<folder-path>"}}
{{- with $secrets }}
{{- range $index, $secret := . }}
{{ $secret.Key }}={{ $secret.Value }}
{{- end }}
{{- end }}

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

The changes have been tested by running the application and confirming the expected output.

$ go run main.go export -f dotenv-plain
...
KEY_1=value_1
KEY_2=value_2
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant