docker-ejabberd icon indicating copy to clipboard operation
docker-ejabberd copied to clipboard

dotenv and python

Open paulb-smartit opened this issue 3 years ago • 0 comments

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.

paulb-smartit avatar Jan 25 '21 21:01 paulb-smartit