#!/usr/bin/env python

import release

from app import app
from data.model.release import set_region_release
from util.config.database import sync_database_with_config


def main():
  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()