<commit_before>"""
Launcher for homity-hub
"""
from Hub import app
from Hub.api import hub_config

import cherrypy
from paste.translogger import TransLogger

if hub_config.get('ssl_enable'):
    from OpenSSL import SSL

def run_server():
    """Enable WSGI access logging via Paste"""
    app_logged = TransLogger(app)

    # Mount the WSGI callable object (app) on the root directory
    cherrypy.tree.graft(app_logged, '/')

    # Set the configuration of the web server

    cherrypy_config = {
        'engine.autoreload_on': True,
        'log.screen': True,
        'server.socket_port': 5000,
        'server.socket_host': '0.0.0.0'
    }
    if hub_config.get('ssl_enable'):
        cherrypy_config['server.ssl_module'] = 'builtin'
        cherrypy_config['server.ssl_private_key'] = hub_config.get('ssl_private_key')
        cherrypy_config['server.ssl_certificate'] = hub_config.get('ssl_cert')

    cherrypy.config.update(cherrypy_config)

    # Start the CherryPy WSGI web server
    cherrypy.engine.start()
    cherrypy.engine.block()

def main():
    """ Main. """
    if hub_config.get('ssl_enable'):
        context = SSL.Context(SSL.SSLv23_METHOD)
        context.use_privatekey_file(hub_config.get('ssl_private_key'))
        context.use_certificate_file(hub_config.get('ssl_cert'))
        app.run(host='0.0.0.0',
                ssl_context=context,<commit_msg>attempt at logging<commit_after>"""
Launcher for homity-hub
"""
from Hub import app
from Hub.api import hub_config

import cherrypy
from paste.translogger import TransLogger

if hub_config.get('ssl_enable'):
    from OpenSSL import SSL

def run_server():
    """Enable WSGI access logging via Paste"""
    app_logged = TransLogger(app)

    # Mount the WSGI callable object (app) on the root directory
    cherrypy.tree.graft(app_logged, '/')

    # Set the configuration of the web server

    cherrypy_config = {
        'engine.autoreload_on': True,
        'log.screen': True,
        'server.socket_port': 5000,
        'server.socket_host': '0.0.0.0',
        'log.error_file': hub_config['logger_path'],
        'log.access_file': hub_config['logger_path']
    }
    if hub_config.get('ssl_enable'):
        cherrypy_config['server.ssl_module'] = 'builtin'
        cherrypy_config['server.ssl_private_key'] = hub_config.get('ssl_private_key')
        cherrypy_config['server.ssl_certificate'] = hub_config.get('ssl_cert')

    cherrypy.config.update(cherrypy_config)

    # Start the CherryPy WSGI web server
    cherrypy.engine.start()
    cherrypy.engine.block()

def main():
    """ Deprecated in favor of CherryPy. """
    if hub_config.get('ssl_enable'):
        context = SSL.Context(SSL.SSLv23_METHOD)
        context.use_privatekey_file(hub_config.get('ssl_private_key'))
        context.use_certificate_file(hub_config.get('ssl_cert'))
        app.run(host='0.0.0.0',
                ssl_context=context,
{'fraction_non_alphanumeric': 0.12064805239572561, 'fraction_numerical': 0.009651844191658049, 'mean_word_length': 3.417047184170472, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4494926', 'n_tokens_mistral': 973, 'n_tokens_neox': 938, 'n_words': 187}