forked from howl-anderson/WeatherBot_Core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrender.py
23 lines (13 loc) · 761 Bytes
/
render.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import os
from jinja2 import Template
def render(input_file, output_file):
with open(input_file, encoding='utf_8') as input_fd, open(output_file, mode='w', encoding='utf_8') as output_fd:
template = Template(input_fd.read())
action_endpoint_url = os.environ.get('ACTION_ENDPOINT_URL', "http://127.0.0.1:5055/webhook")
print("action will connect to {}".format(action_endpoint_url))
nlu_url = os.environ.get('NLU_URL', "http://127.0.0.1:5000")
print("nlu will connect to {}".format(nlu_url))
rendered_string = template.render(action_endpoint_url=action_endpoint_url, nlu_url=nlu_url)
output_fd.write(rendered_string)
if __name__ == "__main__":
render('endpoints.yml.tpl', 'endpoints.yml')