theskumar / theskumar/python-dotenv
Allow overwrite value by None if already defined
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 8.9k
- Forks
- 581
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
I have 2 dotenv files:
Scenario1:
/var/www/flask/.envRoot <---- myVar="foo"
and
/home/userA/.envA <----------- myVar="bar"
load_dotenv(dotenv_path='/var/www/flask/.envRoot',override=True)
os.getenv('myVar') # foo
load_dotenv(dotenv_path='/home/userA/.envA',override=True)
os.getenv('myVar') # bar
Scenario2:
/var/www/flask/.envRoot <---- myVar="foo"
and
/home/userA/.envA <----------- myVar not defined
load_dotenv(dotenv_path='/var/www/flask/.envRoot',override=True)
os.getenv('myVar') # foo
load_dotenv(dotenv_path='/home/userA/.envA',override=True)
os.getenv('myVar') # foo
Scenario1 work as spected, but Scenario2 should return None if do not exist on .envA because i explicitly indicate the file to look at. But this do not happen if the key exist e.g: myVar=, only if not defined.
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Start at the load_dotenv entry point and trace how a later file is handled when myVar is absent versus explicitly set to an empty value. Compare the two scenarios in the issue, then verify that loading .envA removes the earlier value and returns None when myVar is not defined there.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- devops
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100