Got the render_templates script working properly

This commit is contained in:
Chris Diesch 2025-03-28 15:32:01 -06:00
parent 096f363fd2
commit 96364f4cd7
2 changed files with 8 additions and 5 deletions

View File

@ -30,9 +30,9 @@ services:
environment: environment:
- FLASK_APP=run.py # Adjust this based on your Flask app's entry point - FLASK_APP=run.py # Adjust this based on your Flask app's entry point
- FLASK_ENV=dev # Dev environment - FLASK_ENV=dev # Dev environment
- MRE_POSTGRES_PASSWORD={{ POSTGRES_PASSWORD }} - MRE_POSTGRES_PASSWORD={{ POSTGRES_PASSWD }}
- MRE_POSTGRES_USER={{ POSTGRES_USER }} - MRE_POSTGRES_USER={{ POSTGRES_USER }}
- MRE_REDIS_PASSWORD={{ REDIS_PASSWORD }} - MRE_REDIS_PASSWORD={{ REDIS_PASSWD }}
depends_on: depends_on:
- redis - redis
- postgres - postgres
@ -45,7 +45,7 @@ services:
- "6379:6379" # Expose Redis port (for debugging/accessing from outside) - "6379:6379" # Expose Redis port (for debugging/accessing from outside)
volumes: volumes:
- redis_data:/data # Persist Redis data - redis_data:/data # Persist Redis data
command: redis-server --save 20 1 --loglevel {{ LOG_LEGEL }} --requirepass {{ REDIS_PASSWORD }} command: redis-server --save 20 1 --loglevel {{ LOG_LEGEL }} --requirepass {{ REDIS_PASSWD }}
postgres: postgres:
networks: networks:
@ -55,7 +55,7 @@ services:
- "5432:5432" # Expose PostgreSQL port (for debugging/admin) - "5432:5432" # Expose PostgreSQL port (for debugging/admin)
environment: environment:
- POSTGRES_USER={{ POSTGRES_USER }} # Replace with your desired username - POSTGRES_USER={{ POSTGRES_USER }} # Replace with your desired username
- POSTGRES_PASSWORD={{ POSTGRES_PASSWORD }} # Replace with your desired password - POSTGRES_PASSWORD={{ POSTGRES_PASSWD }} # Replace with your desired password
- POSTGRES_DB=yourdb # Replace with your desired database name - POSTGRES_DB=yourdb # Replace with your desired database name
volumes: volumes:
- postgres_data:/var/lib/postgresql/data # Persist PostgreSQL data - postgres_data:/var/lib/postgresql/data # Persist PostgreSQL data

View File

@ -20,6 +20,9 @@ def load_template_vars_file(var_file_path: str) -> dict:
result = {} result = {}
with open(var_file_path) as reader: with open(var_file_path) as reader:
for line in reader: for line in reader:
line = line.strip()
if line.startswith('#') or '=' not in line:
continue
key, value = line.split('=', 1) key, value = line.split('=', 1)
result[key] = value result[key] = value
@ -87,7 +90,7 @@ if __name__ == '__main__':
for template in args.template_path: for template in args.template_path:
out_file_name = os.path.join(args.out_path, out_file_name = os.path.join(args.out_path,
os.path.split(template.remove('.tmpl'))) os.path.split(template.replace('.tmpl', ''))[1])
# if the output exists and we aren't overwritting files, then move on. # if the output exists and we aren't overwritting files, then move on.
if os.path.exists(out_file_name) and not args.overwrite: if os.path.exists(out_file_name) and not args.overwrite:
continue continue