--env assigns all variables to content, instead of dotenv file
This commit is contained in:
1 parent
e7e4a35d02
commit
9a2837b7a9
2 files changed
+7
-7
No files matched your search
+4
-7
@@ -5,7 +5,6 @@ import os
|
|||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import dotenv
|
|
||||||
import toml
|
import toml
|
||||||
import yaml
|
import yaml
|
||||||
from jinja2 import Environment, TemplateError
|
from jinja2 import Environment, TemplateError
|
||||||
@@ -22,9 +21,8 @@ infilegroup.add_argument('--toml', dest='toml_file', type=str, required=False,
|
|||||||
help='TOML file path')
|
help='TOML file path')
|
||||||
infilegroup.add_argument('--ini', dest='ini_file', type=str, required=False,
|
infilegroup.add_argument('--ini', dest='ini_file', type=str, required=False,
|
||||||
help='INI fil path')
|
help='INI fil path')
|
||||||
|
infilegroup.add_argument('--env', dest='env_file', action='store_true',
|
||||||
argsparser.add_argument('--env', dest='env_file', type=bool, required=False, action='store_true',
|
help='Load environment variables')
|
||||||
help='Load .env file from current directory')
|
|
||||||
|
|
||||||
argsparser.add_argument('--output', default='/dev/stdout',
|
argsparser.add_argument('--output', default='/dev/stdout',
|
||||||
help='Output File')
|
help='Output File')
|
||||||
@@ -160,9 +158,8 @@ if __name__ == '__main__':
|
|||||||
# If template was found
|
# If template was found
|
||||||
if tpl:
|
if tpl:
|
||||||
if args.env_file:
|
if args.env_file:
|
||||||
dotenv.load_dotenv(dotenv.find_dotenv(raise_error_if_not_found=False))
|
content = os.environ
|
||||||
# Load content from file, if present
|
elif args.yaml_file:
|
||||||
if args.yaml_file:
|
|
||||||
content = load_yaml_file(args.yaml_file)
|
content = load_yaml_file(args.yaml_file)
|
||||||
elif args.json_file:
|
elif args.json_file:
|
||||||
content = load_json_file(args.json_file)
|
content = load_json_file(args.json_file)
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"Type": "{{ TESTVAR }}",
|
||||||
|
}
|
||||||
Reference in new issue
Block a user