Skip to content

Commit

Permalink
limit to only goerli indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
starknetdev committed Oct 13, 2023
1 parent dde640a commit 362f32a
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions indexer/graphql/src/indexer/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1557,22 +1557,22 @@ async def get_context(self, _request, _response):

async def run_graphql_api(mongo_goerli=None, mongo_mainnet=None, port="8080"):
mongo_goerli = MongoClient(mongo_goerli)
mongo_mainnet = MongoClient(mongo_mainnet)
# mongo_mainnet = MongoClient(mongo_mainnet)
db_name_goerli = "mongo-goerli".replace("-", "_")
db_name_mainnet = "mongo-mainnet".replace("-", "_")
# db_name_mainnet = "mongo-mainnet".replace("-", "_")
db_goerli = mongo_goerli[db_name_goerli]
db_mainnet = mongo_mainnet[db_name_mainnet]
# db_mainnet = mongo_mainnet[db_name_mainnet]

schema = strawberry.Schema(query=Query)
view_goerli = IndexerGraphQLView(db_goerli, schema=schema)
view_mainnet = IndexerGraphQLView(db_mainnet, schema=schema)
# view_mainnet = IndexerGraphQLView(db_mainnet, schema=schema)

app = web.Application()
# app.router.add_route("*", "/graphql", view_goerli)

cors = aiohttp_cors.setup(app)
resource_goerli = cors.add(app.router.add_resource("/goerli-graphql"))
resource_mainnet = cors.add(app.router.add_resource("/graphql"))
# resource_mainnet = cors.add(app.router.add_resource("/graphql"))

cors.add(
resource_goerli.add_route("POST", view_goerli),
Expand All @@ -1591,22 +1591,22 @@ async def run_graphql_api(mongo_goerli=None, mongo_mainnet=None, port="8080"):
},
)

cors.add(
resource_mainnet.add_route("POST", view_mainnet),
{
"*": aiohttp_cors.ResourceOptions(
expose_headers="*", allow_headers="*", allow_methods="*"
),
},
)
cors.add(
resource_mainnet.add_route("GET", view_mainnet),
{
"*": aiohttp_cors.ResourceOptions(
expose_headers="*", allow_headers="*", allow_methods="*"
),
},
)
# cors.add(
# resource_mainnet.add_route("POST", view_mainnet),
# {
# "*": aiohttp_cors.ResourceOptions(
# expose_headers="*", allow_headers="*", allow_methods="*"
# ),
# },
# )
# cors.add(
# resource_mainnet.add_route("GET", view_mainnet),
# {
# "*": aiohttp_cors.ResourceOptions(
# expose_headers="*", allow_headers="*", allow_methods="*"
# ),
# },
# )

ssl_context = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
ssl_context.load_cert_chain(
Expand Down

1 comment on commit 362f32a

@vercel
Copy link

@vercel vercel bot commented on 362f32a Oct 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.