diff options
Diffstat (limited to 'moonv4/moon_consul/moon_consul')
-rw-r--r-- | moonv4/moon_consul/moon_consul/__init__.py | 1 | ||||
-rw-r--r-- | moonv4/moon_consul/moon_consul/__main__.py | 3 | ||||
-rw-r--r-- | moonv4/moon_consul/moon_consul/api/__init__.py | 0 | ||||
-rw-r--r-- | moonv4/moon_consul/moon_consul/api/database.py | 72 | ||||
-rw-r--r-- | moonv4/moon_consul/moon_consul/api/generic.py | 78 | ||||
-rw-r--r-- | moonv4/moon_consul/moon_consul/api/messenger.py | 67 | ||||
-rw-r--r-- | moonv4/moon_consul/moon_consul/api/openstack.py | 63 | ||||
-rw-r--r-- | moonv4/moon_consul/moon_consul/api/slave.py | 72 | ||||
-rw-r--r-- | moonv4/moon_consul/moon_consul/api/system.py | 169 | ||||
-rw-r--r-- | moonv4/moon_consul/moon_consul/http_server.py | 134 | ||||
-rw-r--r-- | moonv4/moon_consul/moon_consul/server.py | 82 |
11 files changed, 741 insertions, 0 deletions
diff --git a/moonv4/moon_consul/moon_consul/__init__.py b/moonv4/moon_consul/moon_consul/__init__.py new file mode 100644 index 00000000..3dc1f76b --- /dev/null +++ b/moonv4/moon_consul/moon_consul/__init__.py @@ -0,0 +1 @@ +__version__ = "0.1.0" diff --git a/moonv4/moon_consul/moon_consul/__main__.py b/moonv4/moon_consul/moon_consul/__main__.py new file mode 100644 index 00000000..4d64288e --- /dev/null +++ b/moonv4/moon_consul/moon_consul/__main__.py @@ -0,0 +1,3 @@ +from moon_consul.server import main + +main() diff --git a/moonv4/moon_consul/moon_consul/api/__init__.py b/moonv4/moon_consul/moon_consul/api/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/moonv4/moon_consul/moon_consul/api/__init__.py diff --git a/moonv4/moon_consul/moon_consul/api/database.py b/moonv4/moon_consul/moon_consul/api/database.py new file mode 100644 index 00000000..5533b1a5 --- /dev/null +++ b/moonv4/moon_consul/moon_consul/api/database.py @@ -0,0 +1,72 @@ +# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors +# This software is distributed under the terms and conditions of the 'Apache-2.0' +# license which can be found in the file 'LICENSE' in this package distribution +# or at 'http://www.apache.org/licenses/LICENSE-2.0'. +""" +Assignments allow to connect data with elements of perimeter + +""" + +from flask import request +from flask_restful import Resource +# from oslo_config import cfg +from oslo_log import log as logging +# from moon_interface.tools import check_auth + +__version__ = "0.1.0" + +LOG = logging.getLogger(__name__) +# CONF = cfg.CONF + + +class Database(Resource): + """ + Endpoint for database requests + """ + + __urls__ = ( + "/configuration/database", + ) + + def __init__(self, *args, **kwargs): + self.conf = kwargs.get('conf', {}) + + # @check_auth + def get(self): + """Retrieve database configuration + + :return: { + "database": { + "hostname": "hostname for the main database", + "port": "port for the main database", + "user": "user for the main database", + "password": "password for the main database", + "protocol": "protocol to use (eg. mysql+pymysql)", + "driver": "driver to use", + } + } + """ + url = self.conf.DB_URL + driver = self.conf.DB_DRIVER + hostname = url.split("@")[-1].split(":")[0].split("/")[0] + try: + port = int(url.split("@")[-1].split(":")[1].split("/")[0]) + except ValueError: + port = None + except IndexError: + port = None + user = url.split("//")[1].split(":")[0] + # TODO: password must be encrypted + password = url.split(":")[2].split("@")[0] + protocol = url.split(":")[0] + return { + "database": { + "hostname": hostname, + "port": port, + "user": user, + "password": password, + "protocol": protocol, + "driver": driver + } + } + diff --git a/moonv4/moon_consul/moon_consul/api/generic.py b/moonv4/moon_consul/moon_consul/api/generic.py new file mode 100644 index 00000000..69f25eef --- /dev/null +++ b/moonv4/moon_consul/moon_consul/api/generic.py @@ -0,0 +1,78 @@ +# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors +# This software is distributed under the terms and conditions of the 'Apache-2.0' +# license which can be found in the file 'LICENSE' in this package distribution +# or at 'http://www.apache.org/licenses/LICENSE-2.0'. +""" +Those API are helping API used to manage the Moon platform. +""" + +from flask_restful import Resource, request +# from oslo_config import cfg +from oslo_log import log as logging +# from moon_utilities.security_functions import call +import moon_consul.api +# from moon_utilities.auth import check_auth + +__version__ = "0.1.0" + +LOG = logging.getLogger(__name__) +# CONF = cfg.CONF + + +class API(Resource): + """ + Endpoint for API requests + """ + + __urls__ = ( + "/api", + "/api/", + "/api/<string:group_id>", + "/api/<string:group_id>/", + "/api/<string:group_id>/<string:endpoint_id>") + + # @check_auth + def get(self, group_id="", endpoint_id="", user_id=""): + """Retrieve all API endpoints or a specific endpoint if endpoint_id is given + + :param group_id: the name of one existing group (ie generic, ...) + :param endpoint_id: the name of one existing component (ie Logs, Status, ...) + :return: { + "group_name": { + "endpoint_name": { + "description": "a description", + "methods": { + "get": "description of the HTTP method" + }, + "urls": ('/api', '/api/', '/api/<string:endpoint_id>') + } + } + """ + __methods = ("get", "post", "put", "delete", "options", "patch") + api_list = filter(lambda x: "__" not in x, dir(moon_consul.api)) + api_desc = dict() + for api_name in api_list: + api_desc[api_name] = {} + group_api_obj = eval("moon_interface.api.{}".format(api_name)) + api_desc[api_name]["description"] = group_api_obj.__doc__ + if "__version__" in dir(group_api_obj): + api_desc[api_name]["version"] = group_api_obj.__version__ + object_list = list(filter(lambda x: "__" not in x, dir(group_api_obj))) + for obj in map(lambda x: eval("moon_interface.api.{}.{}".format(api_name, x)), object_list): + if "__urls__" in dir(obj): + api_desc[api_name][obj.__name__] = dict() + api_desc[api_name][obj.__name__]["urls"] = obj.__urls__ + api_desc[api_name][obj.__name__]["methods"] = dict() + for _method in filter(lambda x: x in __methods, dir(obj)): + docstring = eval("moon_interface.api.{}.{}.{}.__doc__".format(api_name, obj.__name__, _method)) + api_desc[api_name][obj.__name__]["methods"][_method] = docstring + api_desc[api_name][obj.__name__]["description"] = str(obj.__doc__) + if group_id in api_desc: + if endpoint_id in api_desc[group_id]: + return {group_id: {endpoint_id: api_desc[group_id][endpoint_id]}} + elif len(endpoint_id) > 0: + LOG.error("Unknown endpoint_id {}".format(endpoint_id)) + return {"error": "Unknown endpoint_id {}".format(endpoint_id)} + return {group_id: api_desc[group_id]} + return api_desc + diff --git a/moonv4/moon_consul/moon_consul/api/messenger.py b/moonv4/moon_consul/moon_consul/api/messenger.py new file mode 100644 index 00000000..28026baf --- /dev/null +++ b/moonv4/moon_consul/moon_consul/api/messenger.py @@ -0,0 +1,67 @@ +# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors +# This software is distributed under the terms and conditions of the 'Apache-2.0' +# license which can be found in the file 'LICENSE' in this package distribution +# or at 'http://www.apache.org/licenses/LICENSE-2.0'. +""" +Assignments allow to connect data with elements of perimeter + +""" + +from flask import request +from flask_restful import Resource +# from oslo_config import cfg +from oslo_log import log as logging +# from moon_interface.tools import check_auth + +__version__ = "0.1.0" + +LOG = logging.getLogger(__name__) +# CONF = cfg.CONF + + +class Messenger(Resource): + """ + Endpoint for messenger requests + """ + + __urls__ = ( + "/configuration/messenger", + ) + + def __init__(self, *args, **kwargs): + self.conf = kwargs.get('conf', {}) + + # @check_auth + def get(self): + """Retrieve messenger configuration + + :return: { + "messenger": { + "hostname": "hostname for the messenger server", + "port": "port for the main messenger server", + "user": "user for the main messenger server", + "password": "password for the main messenger server", + "protocol": "protocol to use (eg. rabbit)" + } + } + """ + url = self.conf.TRANSPORT_URL + hostname = url.split("@")[-1].split(":")[0].split("/")[0] + try: + port = int(url.split("@")[-1].split(":")[1].split("/")[0]) + except ValueError: + port = None + user = url.split("//")[1].split(":")[0] + # TODO: password must be encrypted + password = url.split(":")[2].split("@")[0] + protocol = url.split(":")[0] + return { + "messenger": { + "hostname": hostname, + "port": port, + "user": user, + "password": password, + "protocol": protocol, + } + } + diff --git a/moonv4/moon_consul/moon_consul/api/openstack.py b/moonv4/moon_consul/moon_consul/api/openstack.py new file mode 100644 index 00000000..5d776981 --- /dev/null +++ b/moonv4/moon_consul/moon_consul/api/openstack.py @@ -0,0 +1,63 @@ +# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors +# This software is distributed under the terms and conditions of the 'Apache-2.0' +# license which can be found in the file 'LICENSE' in this package distribution +# or at 'http://www.apache.org/licenses/LICENSE-2.0'. +""" +Assignments allow to connect data with elements of perimeter + +""" + +from flask import request +from flask_restful import Resource +# from oslo_config import cfg +from oslo_log import log as logging +# from moon_interface.tools import check_auth + +__version__ = "0.1.0" + +LOG = logging.getLogger(__name__) +# CONF = cfg.CONF + + +class Keystone(Resource): + """ + Endpoint for Keystone requests + """ + + __urls__ = ( + "/configuration/os/keystone", + ) + + def __init__(self, *args, **kwargs): + self.conf = kwargs.get('conf', {}) + + # @check_auth + def get(self): + """Retrieve Keystone configuration + + :return: { + "keystone": { + "url": "hostname for the Keystone server", + "user": "user for the Keystone server", + "password": "password for the Keystone server", + "domain": "domain to use against Keystone server", + "project": "main project to use", + "check_token": "yes, no or strict", + "server_crt": "certificate to use when using https" + } + } + """ + # TODO: password must be encrypted + # TODO: check_token is a sensitive information it must not be update through the network + return { + "keystone": { + "url": self.conf.KEYSTONE_URL, + "user": self.conf.KEYSTONE_USER, + "password": self.conf.KEYSTONE_PASSWORD, + "domain": self.conf.KEYSTONE_DOMAIN, + "project": self.conf.KEYSTONE_PROJECT, + "check_token": self.conf.KEYSTONE_CHECK_TOKEN, + "server_crt": self.conf.KEYSTONE_SERVER_CRT + } + } + diff --git a/moonv4/moon_consul/moon_consul/api/slave.py b/moonv4/moon_consul/moon_consul/api/slave.py new file mode 100644 index 00000000..7f8acb28 --- /dev/null +++ b/moonv4/moon_consul/moon_consul/api/slave.py @@ -0,0 +1,72 @@ +# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors +# This software is distributed under the terms and conditions of the 'Apache-2.0' +# license which can be found in the file 'LICENSE' in this package distribution +# or at 'http://www.apache.org/licenses/LICENSE-2.0'. +""" +Assignments allow to connect data with elements of perimeter + +""" + +from flask import request +from flask_restful import Resource +# from oslo_config import cfg +from oslo_log import log as logging +# from moon_interface.tools import check_auth + +__version__ = "0.1.0" + +LOG = logging.getLogger(__name__) +# CONF = cfg.CONF + + +class Slave(Resource): + """ + Endpoint for slave requests + """ + + __urls__ = ( + "/configuration/slave", + ) + + def __init__(self, *args, **kwargs): + self.conf = kwargs.get('conf', {}) + + # @check_auth + def get(self): + """Retrieve slave configuration + + If current server is a slave: + :return: { + "slave": { + "name": "name of the slave", + "master_url": "URL of the master", + "user": [ + { + "username": "user to be used to connect to the master", + "password": "password to be used to connect to the master" + } + ] + } + } + else: + :return: { + "slave": {} + } + """ + # TODO: password must be encrypted + if self.conf.SLAVE_NAME: + return { + "slave": { + "name": self.conf.SLAVE_NAME, + "master_url": self.conf.MASTER_URL, + "user": [ + { + "username": self.conf.MASTER_LOGIN, + "password": self.conf.MASTER_PASSWORD + } + ] + } + } + else: + return {"slave": {}} + diff --git a/moonv4/moon_consul/moon_consul/api/system.py b/moonv4/moon_consul/moon_consul/api/system.py new file mode 100644 index 00000000..e21d9de2 --- /dev/null +++ b/moonv4/moon_consul/moon_consul/api/system.py @@ -0,0 +1,169 @@ +# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors +# This software is distributed under the terms and conditions of the 'Apache-2.0' +# license which can be found in the file 'LICENSE' in this package distribution +# or at 'http://www.apache.org/licenses/LICENSE-2.0'. +""" +Assignments allow to connect data with elements of perimeter + +""" + +from flask import request +from flask_restful import Resource +# from oslo_config import cfg +from oslo_log import log as logging +# from moon_interface.tools import check_auth + +__version__ = "0.1.0" + +LOG = logging.getLogger(__name__) +# CONF = cfg.CONF + + +class Docker(Resource): + """ + Endpoint for system requests + """ + + __urls__ = ( + "/configuration/docker", + ) + + def __init__(self, *args, **kwargs): + self.conf = kwargs.get('conf', {}) + + # @check_auth + def get(self): + """Retrieve docker configuration + + :return: { + "docker": { + "url": "hostname for the docker server (eg. /var/run/docker.sock)", + "port": "port of the server", + "user": "user of the server", + "password": "password of the server", + "protocol": "protocol to use (eg. unix)" + } + } + """ + url = self.conf.DOCKER_URL + # LOG.info(url) + # hostname = url.split("@")[-1].split(":")[0].split("/")[0] + # try: + # port = int(url.split("@")[-1].split(":")[1].split("/")[0]) + # except ValueError: + # port = None + # user = url.split("//")[1].split(":")[0] + # # TODO: password must be encrypted + # try: + # password = url.split(":")[2].split("@")[0] + # except IndexError: + # password = "" + # protocol = url.split(":")[0] + return { + "docker": { + "url": self.conf.DOCKER_URL, + # "port": port, + # "user": user, + # "password": password, + # "protocol": protocol, + } + } + + +class Components(Resource): + """ + Endpoint for requests on components + """ + + __urls__ = ( + "/configuration/components", + "/configuration/components/", + "/configuration/components/<string:id_or_name>", + ) + + def __init__(self, *args, **kwargs): + self.conf = kwargs.get('conf', {}) + + # @check_auth + def get(self, id_or_name=None): + """Retrieve component list + + :param id_or_name: ID or name of the component + + :return: { + "components": [ + { + "hostname": "hostname of the component", + "port": "port of the server in this component", + "id": "id of the component", + "keystone_id": "Keystone project ID served by this component if needed" + }, + ] + } + """ + if id_or_name: + for _component in self.conf.COMPONENTS: + if id_or_name in (_component["hostname"], _component["id"]): + return { + "components": [_component, ] + } + return {"components": []} + return {"components": self.conf.COMPONENTS} + + # @check_auth + def put(self, id_or_name=None): + """Ask for adding a new component + The response gives the TCP port to be used + + :param id_or_name: ID or name of the component + :request body: { + "hostname": "hostname of the new component", + "keystone_id": "Keystone ID mapped to that component (if needed)" + } + :return: { + "components": [ + { + "hostname": "hostname of the component", + "port": "port of the server in this component", + "id": "id of the component", + "keystone_id": "Keystone project ID served by this component" + } + ] + } + """ + if not id_or_name: + return "Need a name for that component", 400 + for _component in self.conf.COMPONENTS: + if id_or_name in (_component["hostname"], _component["id"]): + return "ID already used", 409 + self.conf.COMPONENTS_PORT_START += 1 + port = self.conf.COMPONENTS_PORT_START + data = request.json + new_component = { + "hostname": data.get("hostname", id_or_name), + "port": port, + "id": id_or_name, + "keystone_id": data.get("keystone_id", "") + } + self.conf.COMPONENTS.append(new_component) + return { + "components": [new_component, ] + } + + # @check_auth + def delete(self, id_or_name=None): + """Delete a component + + :param id_or_name: ID or name of the component + :return: { + "result": true + } + """ + if not id_or_name: + return "Need a name for that component", 400 + for index, _component in enumerate(self.conf.COMPONENTS): + if id_or_name in (_component["hostname"], _component["id"]): + self.conf.COMPONENTS.pop(index) + return {"result": True} + return "Cannot find component named {}".format(id_or_name), 403 + diff --git a/moonv4/moon_consul/moon_consul/http_server.py b/moonv4/moon_consul/moon_consul/http_server.py new file mode 100644 index 00000000..c3d13378 --- /dev/null +++ b/moonv4/moon_consul/moon_consul/http_server.py @@ -0,0 +1,134 @@ +# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors +# This software is distributed under the terms and conditions of the 'Apache-2.0' +# license which can be found in the file 'LICENSE' in this package distribution +# or at 'http://www.apache.org/licenses/LICENSE-2.0'. + +from flask import Flask, request +from flask_cors import CORS, cross_origin +from flask_restful import Resource, Api, reqparse +import logging +from moon_consul import __version__ +from moon_consul.api.generic import API +from moon_consul.api.database import Database +from moon_consul.api.messenger import Messenger +from moon_consul.api.openstack import Keystone +from moon_consul.api.slave import Slave +from moon_consul.api.system import Docker, Components +from moon_utilities import exceptions + +logger = logging.getLogger(__name__) + + +class Server: + """Base class for HTTP server""" + + def __init__(self, host="localhost", port=80, api=None, **kwargs): + """Run a server + + :param host: hostname of the server + :param port: port for the running server + :param kwargs: optional parameters + :return: a running server + """ + self._host = host + self._port = port + self._api = api + self._extra = kwargs + + @property + def host(self): + return self._host + + @host.setter + def host(self, name): + self._host = name + + @host.deleter + def host(self): + self._host = "" + + @property + def port(self): + return self._port + + @port.setter + def port(self, number): + self._port = number + + @port.deleter + def port(self): + self._port = 80 + + def run(self): + raise NotImplementedError() + +__API__ = ( + API, + Database, Docker, Messenger, Keystone, Slave, Components + ) + + +class Root(Resource): + """ + The root of the web service + """ + __urls__ = ("/", ) + __methods = ("get", "post", "put", "delete", "options") + + def get(self): + tree = {"/": {"methods": ("get",), "description": "List all methods for that service."}} + for item in __API__: + tree[item.__name__] = {"urls": item.__urls__} + _methods = [] + for _method in self.__methods: + if _method in dir(item): + _methods.append(_method) + tree[item.__name__]["methods"] = _methods + tree[item.__name__]["description"] = item.__doc__.strip() + return { + "version": __version__, + "tree": tree + } + + +class HTTPServer(Server): + + def __init__(self, host="localhost", port=80, conf=None, **kwargs): + super(HTTPServer, self).__init__(host=host, port=port, **kwargs) + self.app = Flask(__name__) + self.conf = conf + # Todo : specify only few urls instead of * + # CORS(self.app) + self.api = Api(self.app) + self.__set_route() + # self.__hook_errors() + + @self.app.errorhandler(exceptions.AuthException) + def _auth_exception(error): + return {"error": "Unauthorized"}, 401 + + def __hook_errors(self): + # FIXME (dthom): it doesn't work + def get_404_json(e): + return {"error": "Error", "code": 404, "description": e} + self.app.register_error_handler(404, get_404_json) + + def get_400_json(e): + return {"error": "Error", "code": 400, "description": e} + self.app.register_error_handler(400, lambda e: get_400_json) + self.app.register_error_handler(403, exceptions.AuthException) + + def __set_route(self): + self.api.add_resource(Root, '/') + + for api in __API__: + self.api.add_resource( + api, *api.__urls__, + resource_class_kwargs={ + "conf": self.conf, + } + ) + + def run(self): + self.app.run(debug=True, host=self._host, port=self._port) # nosec + diff --git a/moonv4/moon_consul/moon_consul/server.py b/moonv4/moon_consul/moon_consul/server.py new file mode 100644 index 00000000..7d42228b --- /dev/null +++ b/moonv4/moon_consul/moon_consul/server.py @@ -0,0 +1,82 @@ +# Copyright 2015 Open Platform for NFV Project, Inc. and its contributors +# This software is distributed under the terms and conditions of the 'Apache-2.0' +# license which can be found in the file 'LICENSE' in this package distribution +# or at 'http://www.apache.org/licenses/LICENSE-2.0'. + +import os +# from oslo_config import cfg +from oslo_log import log as logging +# from moon_utilities import options # noqa +from moon_consul.http_server import HTTPServer + +LOG = logging.getLogger(__name__) +# CONF = cfg.CONF +# DOMAIN = "moon_consul" + +# __CWD__ = os.path.dirname(os.path.abspath(__file__)) + + +class Configuration: + DB_URL = None + DB_DRIVER = None + TRANSPORT_URL = None + DOCKER_URL = None + SLAVE_NAME = None + MASTER_URL = None + MASTER_LOGIN = None + MASTER_PASSWORD = None + INTERFACE_PORT = None + CONSUL_HOST = None + CONSUL_PORT = None + KEYSTONE_URL = None + KEYSTONE_USER = None + KEYSTONE_PASSWORD = None + KEYSTONE_DOMAIN = None + KEYSTONE_PROJECT = None + KEYSTONE_CHECK_TOKEN = None + KEYSTONE_SERVER_CRT = None + PLUGIN_CONTAINERS = None + + +def get_configuration(): + conf = Configuration() + conf.DB_URL = os.getenv("DB_URL", "mysql+pymysql://moon:p4sswOrd1@db/moon") + conf.DB_DRIVER = os.getenv("DB_DRIVER", "sql") + conf.TRANSPORT_URL = os.getenv("TRANSPORT_URL", "rabbit://moon:p4sswOrd1@messenger:5672/moon") + conf.DOCKER_URL = os.getenv("DOCKER_URL", "unix://var/run/docker.sock") + conf.SLAVE_NAME = os.getenv("SLAVE_NAME", "") + conf.MASTER_URL = os.getenv("MASTER_URL", "") + conf.MASTER_LOGIN = os.getenv("MASTER_LOGIN", "") + conf.MASTER_PASSWORD = os.getenv("MASTER_PASSWORD", "") + conf.INTERFACE_PORT = os.getenv("INTERFACE_PORT", "8080") + conf.CONSUL_HOST = os.getenv("CONSUL_HOST", "172.88.88.88") + conf.CONSUL_PORT = os.getenv("CONSUL_PORT", "88") + conf.KEYSTONE_URL = os.getenv("KEYSTONE_URL", "http://keystone:5000/v3") + conf.KEYSTONE_USER = os.getenv("KEYSTONE_USER", "admin") + conf.KEYSTONE_PASSWORD = os.getenv("KEYSTONE_PASSWORD", "p4ssw0rd") + conf.KEYSTONE_DOMAIN = os.getenv("KEYSTONE_DOMAIN", "default") + conf.KEYSTONE_PROJECT = os.getenv("KEYSTONE_PROJECT", "admin") + conf.KEYSTONE_CHECK_TOKEN = os.getenv("KEYSTONE_CHECK_TOKEN", False) + conf.KEYSTONE_SERVER_CRT = os.getenv("KEYSTONE_SERVER_CRT", False) + conf.PLUGIN_CONTAINERS = os.getenv("PLUGIN_CONTAINERS", "asteroide/authz:latest,asteroide/session:latest") + conf.COMPONENTS_PORT_START = int(os.getenv("COMPONENTS_PORT_START", "38001")) + conf.COMPONENTS = [ + { + "hostname": conf.CONSUL_HOST, + "port": conf.CONSUL_PORT, + "id": "consul", + "keystone_id": None + }, + ] + return conf + + +def main(): + conf = get_configuration() + LOG.info("Starting server with IP {} on port {}".format(conf.CONSUL_HOST, conf.CONSUL_PORT)) + server = HTTPServer(host=conf.CONSUL_HOST, port=int(conf.CONSUL_PORT), conf=conf) + server.run() + + +if __name__ == '__main__': + main() |