rroemhild / docker-ejabberd

Dockerfile for Ejabberd server
MIT License
268 stars 160 forks source link

dotenv and python #202

Open paulb-smartit opened 3 years ago

paulb-smartit commented 3 years ago

I learned a lot from this so thanks. Coincidentally I'm also templating an ejabberd project, but in regards to using it with keycloak. It was the templating that I searched and found this git.

Thought I might give a little back to cut down your code for templating. I too wanted to use a dotenv that I already have for docker, but didn't want to expand all my variables in my script. So I used python-dotenv to modify your work.

readonly PYTHON_JINJA2="import os;
import sys;
import jinja2;
from dotenv import load_dotenv;
load_dotenv(verbose=True)
sys.stdout.write(
    jinja2.Template
        (sys.stdin.read()
    ).render(env=os.environ))"

No need to expand variables anymore.