#!/usr/bin/python3
import tornado.ioloop
import tornado.web
from app_scaler.apis import RemoteAppApi
from app_scaler.facades import AppRepoFacade
from app_scaler.config import Config
import os

config = Config()
repo_facade = AppRepoFacade(config)
application = tornado.web.Application([
    (r"/", RemoteAppApi, dict(repo_facade=repo_facade)),
])

if __name__ == "__main__":
    if not os.path.exists('/tmp/apps'):
        os.makedirs('/tmp/apps')
    application.listen(1000)
    tornado.ioloop.IOLoop.instance().start()
