예제 #1
0
def create_main_server(port):
    server = grpc.server(
        futures.ThreadPoolExecutor(SERVER_THREADS),
        interceptors=[
            ErrorSanitizationInterceptor(),
            TracingInterceptor(),
            AuthValidatorInterceptor(),
        ],
    )
    server.add_insecure_port(f"[::]:{port}")

    account_pb2_grpc.add_AccountServicer_to_server(Account(), server)
    admin_pb2_grpc.add_AdminServicer_to_server(Admin(), server)
    api_pb2_grpc.add_APIServicer_to_server(API(), server)
    auth_pb2_grpc.add_AuthServicer_to_server(Auth(), server)
    blocking_pb2_grpc.add_BlockingServicer_to_server(Blocking(), server)
    bugs_pb2_grpc.add_BugsServicer_to_server(Bugs(), server)
    communities_pb2_grpc.add_CommunitiesServicer_to_server(
        Communities(), server)
    conversations_pb2_grpc.add_ConversationsServicer_to_server(
        Conversations(), server)
    discussions_pb2_grpc.add_DiscussionsServicer_to_server(
        Discussions(), server)
    donations_pb2_grpc.add_DonationsServicer_to_server(Donations(), server)
    events_pb2_grpc.add_EventsServicer_to_server(Events(), server)
    gis_pb2_grpc.add_GISServicer_to_server(GIS(), server)
    groups_pb2_grpc.add_GroupsServicer_to_server(Groups(), server)
    jail_pb2_grpc.add_JailServicer_to_server(Jail(), server)
    notifications_pb2_grpc.add_NotificationsServicer_to_server(
        Notifications(), server)
    pages_pb2_grpc.add_PagesServicer_to_server(Pages(), server)
    references_pb2_grpc.add_ReferencesServicer_to_server(References(), server)
    reporting_pb2_grpc.add_ReportingServicer_to_server(Reporting(), server)
    requests_pb2_grpc.add_RequestsServicer_to_server(Requests(), server)
    resources_pb2_grpc.add_ResourcesServicer_to_server(Resources(), server)
    search_pb2_grpc.add_SearchServicer_to_server(Search(), server)
    stripe_pb2_grpc.add_StripeServicer_to_server(Stripe(), server)
    threads_pb2_grpc.add_ThreadsServicer_to_server(Threads(), server)
    return server
예제 #2
0
def groups_session(token):
    channel = fake_channel(token)
    groups_pb2_grpc.add_GroupsServicer_to_server(Groups(), channel)
    yield groups_pb2_grpc.GroupsStub(channel)
예제 #3
0
            LoggingInterceptor(),
            auth.get_auth_interceptor(allow_jailed=False),
        ],
    )
    server.add_insecure_port("[::]:1751")

    account_pb2_grpc.add_AccountServicer_to_server(Account(), server)
    api_pb2_grpc.add_APIServicer_to_server(servicer, server)
    communities_pb2_grpc.add_CommunitiesServicer_to_server(
        Communities(), server)
    conversations_pb2_grpc.add_ConversationsServicer_to_server(
        Conversations(), server)
    discussions_pb2_grpc.add_DiscussionsServicer_to_server(
        Discussions(), server)
    gis_pb2_grpc.add_GISServicer_to_server(GIS(), server)
    groups_pb2_grpc.add_GroupsServicer_to_server(Groups(), server)
    pages_pb2_grpc.add_PagesServicer_to_server(Pages(), server)
    references_pb2_grpc.add_ReferencesServicer_to_server(References(), server)
    requests_pb2_grpc.add_RequestsServicer_to_server(Requests(), server)
    search_pb2_grpc.add_SearchServicer_to_server(Search(), server)
    threads_pb2_grpc.add_ThreadsServicer_to_server(Threads(), server)

    server.start()

    media_server = grpc.server(
        futures.ThreadPoolExecutor(2),
        interceptors=[
            LoggingInterceptor(),
            get_media_auth_interceptor(
                config.config["MEDIA_SERVER_BEARER_TOKEN"])
        ],