--env assigns all variables to content, instead of dotenv file

This commit is contained in:
dennis authored and Dennis Twardowsky committed 2021-07-06 23:29:20 +02:00
1 parent e7e4a35d02
commit 9a2837b7a9
2 files changed
+7 -7

No files matched your search

+4 -7
View File
@@ -5,7 +5,6 @@ import os
import socket
import sys
import dotenv
import toml
import yaml
from jinja2 import Environment, TemplateError
@@ -22,9 +21,8 @@ infilegroup.add_argument('--toml', dest='toml_file', type=str, required=False,
help='TOML file path')
infilegroup.add_argument('--ini', dest='ini_file', type=str, required=False,
help='INI fil path')
argsparser.add_argument('--env', dest='env_file', type=bool, required=False, action='store_true',
help='Load .env file from current directory')
infilegroup.add_argument('--env', dest='env_file', action='store_true',
help='Load environment variables')
argsparser.add_argument('--output', default='/dev/stdout',
help='Output File')
@@ -160,9 +158,8 @@ if __name__ == '__main__':
# If template was found
if tpl:
if args.env_file:
dotenv.load_dotenv(dotenv.find_dotenv(raise_error_if_not_found=False))
# Load content from file, if present
if args.yaml_file:
content = os.environ
elif args.yaml_file:
content = load_yaml_file(args.yaml_file)
elif args.json_file:
content = load_json_file(args.json_file)
+3
View File
@@ -0,0 +1,3 @@
{
"Type": "{{ TESTVAR }}",
}