diff --git a/config/dev.yml b/config/dev.yml --- a/config/dev.yml +++ b/config/dev.yml @@ -7,3 +7,5 @@ url: http://moma.internal.softwareheritage.org:5010 debug: yes + +introspection: yes diff --git a/config/staging.yml b/config/staging.yml --- a/config/staging.yml +++ b/config/staging.yml @@ -7,3 +7,5 @@ url: http://webapp.internal.staging.swh.network:5010 debug: no + +introspection: yes diff --git a/swh/graphql/server.py b/swh/graphql/server.py --- a/swh/graphql/server.py +++ b/swh/graphql/server.py @@ -77,7 +77,12 @@ graphql_cfg = load_and_check_config(config_path) application = CORSMiddleware( - GraphQL(schema, debug=graphql_cfg["debug"], error_formatter=format_error), + GraphQL( + schema, + debug=graphql_cfg["debug"], + error_formatter=format_error, + introspection=graphql_cfg["introspection"], + ), # FIXME, restrict origins after deploying the JS client allow_origins=["*"], allow_methods=("GET", "POST", "OPTIONS"), diff --git a/swh/graphql/tests/unit/test_server.py b/swh/graphql/tests/unit/test_server.py --- a/swh/graphql/tests/unit/test_server.py +++ b/swh/graphql/tests/unit/test_server.py @@ -55,7 +55,11 @@ def test_make_app_from_configfile_with_config(mocker): - server.graphql_cfg = {"storage": {"test": "test"}, "debug": True} + server.graphql_cfg = { + "storage": {"test": "test"}, + "debug": True, + "introspection": True, + } mocker.patch("starlette.middleware.cors.CORSMiddleware", return_value="dummy-app") assert server.make_app_from_configfile() == "dummy-app"