Beispiel #1
0
def bugs_session():
    channel = FakeChannel()
    bugs_pb2_grpc.add_BugsServicer_to_server(Bugs(), channel)
    yield bugs_pb2_grpc.BugsStub(channel)
Beispiel #2
0
apply_migrations()

if config.config["ADD_DUMMY_DATA"]:
    add_dummy_data()

logger.info(f"Starting")

if config.config["ROLE"] in ["api", "all"]:
    auth = Auth()
    open_server = grpc.server(
        futures.ThreadPoolExecutor(2),
        interceptors=[ErrorSanitizationInterceptor(),
                      LoggingInterceptor()])
    open_server.add_insecure_port("[::]:1752")
    auth_pb2_grpc.add_AuthServicer_to_server(auth, open_server)
    bugs_pb2_grpc.add_BugsServicer_to_server(Bugs(), open_server)
    resources_pb2_grpc.add_ResourcesServicer_to_server(Resources(),
                                                       open_server)
    open_server.start()

    jailed_server = grpc.server(
        futures.ThreadPoolExecutor(2),
        interceptors=[
            ErrorSanitizationInterceptor(),
            LoggingInterceptor(),
            auth.get_auth_interceptor(allow_jailed=True),
        ],
    )
    jailed_server.add_insecure_port("[::]:1754")
    jail_pb2_grpc.add_JailServicer_to_server(Jail(), jailed_server)
    jailed_server.start()