Пример #1
0
def main():
    """
    main() for redirectd. Starts the server threads.
    """
    service = MagmaService('redirectd', mconfigs_pb2.RedirectD())

    # Optionally pipe errors to Sentry
    sentry_init(service_name=service.name)

    redirect_ip = get_service_config_value(
        'pipelined',
        'bridge_ip_address', None,
    )
    if redirect_ip is None:
        logging.error("ERROR bridge_ip_address not found in pipelined config")
        service.close()
        return

    http_port = service.config['http_port']
    exit_callback = get_exit_server_thread_callback(service)
    run_server_thread(run_flask, redirect_ip, http_port, exit_callback)

    # Run the service loop
    service.run()

    # Cleanup the service
    service.close()
Пример #2
0
def main():
    """
    main() for redirectd

    Initializes the scribe logger, starts the server threads
    """
    service = MagmaService('redirectd', mconfigs_pb2.RedirectD())

    scribe_logger = None
    if service.config.get('scribe_logging_enabled', False):
        scribe_logger = RedirectScribeLogger(service.loop)

    redirect_ip = get_service_config_value(
        'pipelined',
        'bridge_ip_address',
        None,
    )
    if redirect_ip is None:
        logging.error("ERROR bridge_ip_address not found in pipelined config")
        service.close()
        return

    http_port = service.config['http_port']
    exit_callback = get_exit_server_thread_callback(service)
    run_server_thread(run_flask, redirect_ip, http_port, scribe_logger,
                      exit_callback)

    # Run the service loop
    service.run()

    # Cleanup the service
    service.close()