43 lines
965 B
Python
43 lines
965 B
Python
#!/usr/bin/env python
|
|
|
|
from urlparse import urlunparse
|
|
|
|
import release
|
|
from jinja2 import Template
|
|
|
|
from app import app
|
|
from data.model.release import set_region_release
|
|
from util.config.database import sync_database_with_config
|
|
|
|
|
|
def create_jwtproxy_conf():
|
|
audience = urlunparse((
|
|
app.config.get('PREFERRED_URL_SCHEME'),
|
|
app.config.get('SERVER_HOSTNAME'), '', '', '', ''))
|
|
|
|
registry = audience + '/keys'
|
|
|
|
with open("/conf/jwtproxy_conf.yaml.jnj") as f:
|
|
template = Template(f.read())
|
|
rendered = template.render(
|
|
audience=audience,
|
|
registry=registry
|
|
)
|
|
|
|
with open('/conf/jwtproxy_conf.yaml', 'w') as f:
|
|
f.write(rendered)
|
|
|
|
|
|
def main():
|
|
create_jwtproxy_conf()
|
|
|
|
if app.config.get('SETUP_COMPLETE', False):
|
|
sync_database_with_config(app.config)
|
|
|
|
# Record deploy
|
|
if release.REGION and release.GIT_HEAD:
|
|
set_region_release(release.SERVICE, release.REGION, release.GIT_HEAD)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|