distil/bin/web.py
Aurynn Shaw bf671c0210 Moves the artifice web API into the artifice package. Updates the build
system to create a working .deb, based on the makefile.
Adds a new script to start up the web daemon.
Adds a new script to test if the database is provisioned
Adds a new script used by Puppet to provision the database
Adds puppet manifests (mirrored in main puppet)
Moves api/ to artifice/api
Alters some of the relative imports
Moves artifice.py to why_is_this_called_artifice.py, as it was causing
import issues.

Change-Id: Id8a909f7ffcc64a5c4e3281c6b5ba83cef73b596
2014-04-01 16:08:49 +13:00

26 lines
648 B
Python

#!/usr/bin/python
from artifice.api import web
import yaml
import sys
import argparse
a = argparse.ArgumentParser("Web service for Artifice")
a.add_argument("-c", "--config", dest="config", help="Path to config file", default="/etc/artifice/conf.yaml")
a.add_argument("-i", "--interface", dest="ip", help="IP address to serve on.", default="0.0.0.0")
a.add_argument("-p", "--port", help="port to serve on", default="8000")
args = a.parse_args()
conf = None
try:
conf = yaml.load(args.config)
except IOError as e:
print "Couldn't load config file: %s" % e
sys.exit(1)
app = web.get_app(conf)
app.run(host=args.ip, port=args.port)