theskumar / theskumar/python-dotenv

Avoid ending up with double quoted variables in docker.

Open
#545 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.9k
Forks
581
PR merge metrics
No merged PRs in 30d

Description

Related to the buggy way docker handles env-files
see https://github.com/docker/cli/issues/3630#issuecomment-2599705392

When you quote variables in your .env (which IHMO is a best practice):

FOO=BAR
FOO1='BAR1'
FOO2="BAR2"

and then you run docker via docker run --env-file .env
you end up with literal quoted variables inside docker:

FOO=BAR
FOO1='BAR1'
FOO2="BAR2"

This is incorrect, and should be fixed in docker.

and in python via python-dotenv, they become double quoted variables


>>> os.getenv("FOO")
'BAR'

>>> os.getenv("FOO1")
"'BAR1'"

>>> os.getenv("FOO2")
'"BAR2"'

As a work-around for the root-cause, could be avoid ending up with double-quoted variables in python?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository file, test, or entry point. Reproduce the quoted .env examples with python-dotenv and compare the resulting values with the expected behavior described in the issue. Confirm the intended handling of single- and double-quoted assignments, then verify the result with an appropriate repository test or documented outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
devops, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.