diff options
author | Thomas Duval <thomas.duval@orange.com> | 2018-01-03 14:23:22 +0100 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2018-01-03 14:23:22 +0100 |
commit | 17d1bd8c4c8fbd81af85edbde059a28a852a0deb (patch) | |
tree | 1a1360e961945f770d3b0feca621ccbf6cd84773 /moon_interface/moon_interface/server.py | |
parent | 52d037e757ac2189978e1129f469929fe73a9b7f (diff) |
Clean the code and fix some bugs
Change-Id: I540aeea0af749f86f4c2378864b17d277517b85f
Diffstat (limited to 'moon_interface/moon_interface/server.py')
-rw-r--r-- | moon_interface/moon_interface/server.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/moon_interface/moon_interface/server.py b/moon_interface/moon_interface/server.py index 8b53d7f3..13955c3e 100644 --- a/moon_interface/moon_interface/server.py +++ b/moon_interface/moon_interface/server.py @@ -7,10 +7,10 @@ import logging from python_moonutilities import configuration, exceptions from moon_interface.http_server import HTTPServer -LOG = logging.getLogger("moon.interface.server") +logger = logging.getLogger("moon.interface.server") -def main(): +def create_server(): configuration.init_logging() try: conf = configuration.get_configuration("components/interface") @@ -21,11 +21,19 @@ def main(): hostname = "interface" bind = "127.0.0.1" port = 80 - configuration.add_component(uuid="interface", name=hostname, port=port, bind=bind) - LOG.info("Starting server with IP {} on port {} bind to {}".format(hostname, port, bind)) + configuration.add_component(uuid="interface", + name=hostname, + port=port, + bind=bind) + logger.info("Starting server with IP {} on port {} bind to {}".format( + hostname, port, bind)) return HTTPServer(host=bind, port=port) -if __name__ == '__main__': - server = main() +def run(): + server = create_server() server.run() + + +if __name__ == '__main__': + run() |