env assigns all variables to content including dotenv file
This commit is contained in:
1 parent
9a2837b7a9
commit
beee0b14a7
1 file changed
+6
-2
+6
-2
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import configparser
|
||||
import json
|
||||
import os
|
||||
@@ -7,8 +8,8 @@ import sys
|
||||
|
||||
import toml
|
||||
import yaml
|
||||
from dotenv import dotenv_values
|
||||
from jinja2 import Environment, TemplateError
|
||||
import argparse
|
||||
|
||||
argsparser = argparse.ArgumentParser(description='Jinja Template Helper')
|
||||
|
||||
@@ -146,6 +147,9 @@ def render_template(template, outfile, variables=None):
|
||||
|
||||
except TemplateError as exc:
|
||||
print_error("Rendering Error:", exc.message)
|
||||
print_error("Values:")
|
||||
for i, v in variables.items():
|
||||
print_error(" %s = %s", i, v)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -158,7 +162,7 @@ if __name__ == '__main__':
|
||||
# If template was found
|
||||
if tpl:
|
||||
if args.env_file:
|
||||
content = os.environ
|
||||
content = os.environ | dotenv_values(".env")
|
||||
elif args.yaml_file:
|
||||
content = load_yaml_file(args.yaml_file)
|
||||
elif args.json_file:
|
||||
|
||||
Reference in new issue
Block a user