File tree 3 files changed +8
-2
lines changed
3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
11
11
12
12
- Add support to use a custom dict instead of os.environ for variable
13
13
interpolating when calling ` dotenv_values ` (by [ @johnbergvall ] )
14
+ - Add override-flag to ` dotenv_values ` to allow for more advanced
15
+ chaining of env-files (#73 #186 by [ @johnbergvall ] )
14
16
15
17
## [ 0.19.0] - 2021-07-24
16
18
Original file line number Diff line number Diff line change @@ -110,7 +110,8 @@ deploy_env = {
110
110
' VERSION' : ' 1.5' ,
111
111
}
112
112
env = dotenv_values(' .env.deployment01' , base_env = {
113
- ** dotenv_values(' .env.base' , base_env = deploy_env),
113
+ # override=False to ignore local file overrides in interpolations:
114
+ ** dotenv_values(' .env.base' , override = False , base_env = deploy_env),
114
115
** deploy_env,
115
116
})
116
117
subprocess.call(
Original file line number Diff line number Diff line change @@ -337,6 +337,7 @@ def dotenv_values(
337
337
dotenv_path : Union [str , _PathLike , None ] = None ,
338
338
stream : Optional [IO [str ]] = None ,
339
339
verbose : bool = False ,
340
+ override : bool = True ,
340
341
interpolate : bool = True ,
341
342
encoding : Optional [str ] = "utf-8" ,
342
343
base_env : Mapping [str , Optional [str ]] = os .environ ,
@@ -348,6 +349,8 @@ def dotenv_values(
348
349
- *stream*: `StringIO` object with .env content, used if `dotenv_path` is `None`.
349
350
- *verbose*: whether to output a warning the .env file is missing. Defaults to
350
351
`False`.
352
+ - *override*: whether to override the system environment/`base_env` variables with
353
+ the variables in `.env` file. Defaults to `True` as opposed to `load_dotenv`.
351
354
- *encoding*: encoding to be used to read the file.
352
355
- *base_env*: dict with initial environment. Defaults to os.environ
353
356
@@ -361,7 +364,7 @@ def dotenv_values(
361
364
stream = stream ,
362
365
verbose = verbose ,
363
366
interpolate = interpolate ,
364
- override = True ,
367
+ override = override ,
365
368
encoding = encoding ,
366
369
base_env = base_env ,
367
370
).dict ()
You can’t perform that action at this time.
0 commit comments