From 96364f4cd782c9ffead19c51cc6ae9b6aa991bb2 Mon Sep 17 00:00:00 2001 From: Chris Diesch Date: Fri, 28 Mar 2025 15:32:01 -0600 Subject: [PATCH] Got the render_templates script working properly --- docker/docker-compose.yaml.tmpl | 8 ++++---- scripts/render_templates.py | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docker/docker-compose.yaml.tmpl b/docker/docker-compose.yaml.tmpl index ca54e36..29ee7d0 100644 --- a/docker/docker-compose.yaml.tmpl +++ b/docker/docker-compose.yaml.tmpl @@ -30,9 +30,9 @@ services: environment: - FLASK_APP=run.py # Adjust this based on your Flask app's entry point - FLASK_ENV=dev # Dev environment - - MRE_POSTGRES_PASSWORD={{ POSTGRES_PASSWORD }} + - MRE_POSTGRES_PASSWORD={{ POSTGRES_PASSWD }} - MRE_POSTGRES_USER={{ POSTGRES_USER }} - - MRE_REDIS_PASSWORD={{ REDIS_PASSWORD }} + - MRE_REDIS_PASSWORD={{ REDIS_PASSWD }} depends_on: - redis - postgres @@ -45,7 +45,7 @@ services: - "6379:6379" # Expose Redis port (for debugging/accessing from outside) volumes: - 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: networks: @@ -55,7 +55,7 @@ services: - "5432:5432" # Expose PostgreSQL port (for debugging/admin) environment: - 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 volumes: - postgres_data:/var/lib/postgresql/data # Persist PostgreSQL data diff --git a/scripts/render_templates.py b/scripts/render_templates.py index ba6c745..7ad37b5 100644 --- a/scripts/render_templates.py +++ b/scripts/render_templates.py @@ -20,6 +20,9 @@ def load_template_vars_file(var_file_path: str) -> dict: result = {} with open(var_file_path) as reader: for line in reader: + line = line.strip() + if line.startswith('#') or '=' not in line: + continue key, value = line.split('=', 1) result[key] = value @@ -87,7 +90,7 @@ if __name__ == '__main__': for template in args.template_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 os.path.exists(out_file_name) and not args.overwrite: continue