Cleanup
This commit is contained in:
parent
cdc55411b5
commit
8668b43880
21
src/phi.py
Normal file
21
src/phi.py
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
from pprint import pformat as pp
|
||||||
|
|
||||||
|
from phi.config import get_config
|
||||||
|
from phi.logging import setup_logging, get_logger
|
||||||
|
from phi.app import setup_app, run_app
|
||||||
|
|
||||||
|
log = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
config_file, config = get_config()
|
||||||
|
|
||||||
|
# Beware that everything happened until now
|
||||||
|
# could not possibly get logged.
|
||||||
|
setup_logging(config.get('logging', {}))
|
||||||
|
|
||||||
|
log.info("Found configuration at '{}':\n{}"
|
||||||
|
.format(config_file, pp(config)))
|
||||||
|
|
||||||
|
app = setup_app(config)
|
||||||
|
run_app(app)
|
|
@ -16,10 +16,6 @@ def setup_app(config):
|
||||||
return app
|
return app
|
||||||
|
|
||||||
|
|
||||||
def shutdown_app(app):
|
|
||||||
app['ldap_client'].close()
|
|
||||||
|
|
||||||
|
|
||||||
def run_app(app):
|
def run_app(app):
|
||||||
web.run_app(app,
|
web.run_app(app,
|
||||||
host=app['config']['core']['listen'].get('host', '127.0.0.1'),
|
host=app['config']['core']['listen'].get('host', '127.0.0.1'),
|
||||||
|
|
1
src/phid
1
src/phid
|
@ -5,7 +5,6 @@ from phi.config import get_config
|
||||||
from phi.logging import setup_logging, get_logger
|
from phi.logging import setup_logging, get_logger
|
||||||
from phi.app import setup_app, run_app
|
from phi.app import setup_app, run_app
|
||||||
|
|
||||||
|
|
||||||
log = get_logger(__name__)
|
log = get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user