forked from EmanuellQA/disputable-values-monitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange_address.py
25 lines (21 loc) · 936 Bytes
/
change_address.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
import sys
from jinja2 import Environment, FileSystemLoader
# Load the YAML data
with open('./templates/template_contract_directory.json', 'r') as template_file:
template_data = template_file.read()
# Create a Jinja2 environment and render the template with environment variables
template_env = Environment(loader=FileSystemLoader(searchpath='./'))
template = template_env.from_string(template_data)
rendered_data = template.render(
os=os,
autopay_address=os.environ["AUTOPAY_ADDRESS"],
fetchflex_address=os.environ["FETCHFLEX_ADDRESS"],
fetch_token=os.environ["FETCHTOKEN_ADDRESS"],
fetch_governance=os.environ["GOVERNANCE_ADDRESS"]
)
env_name = os.environ["ENV_NAME"]
# Save the modified YAML data back to the file
with open(f"/usr/local/lib/python3.9/site-packages/telliot_core/data/contract_directory.{env_name}.json", 'w') as output_file:
sys.stdout = output_file
print(rendered_data)