Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: query suggestions are enabled when debugging #499

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions open_city_profile/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@
DEFAULT_FROM_EMAIL = env.str("DEFAULT_FROM_EMAIL")

# Set to True to enable GraphiQL interface, enabled automatically if DEBUG=True
ENABLE_GRAPHIQL = env("ENABLE_GRAPHIQL")
ENABLE_GRAPHIQL = env("ENABLE_GRAPHIQL") or env("DEBUG")
# Enable GraphQL introspection queries, enabled automatically if DEBUG=True
ENABLE_GRAPHQL_INTROSPECTION = env("ENABLE_GRAPHQL_INTROSPECTION")
ENABLE_GRAPHQL_INTROSPECTION = env("ENABLE_GRAPHQL_INTROSPECTION") or env("DEBUG")

if not ENABLE_GRAPHQL_INTROSPECTION:
enable_graphql_query_suggestion(False)
Expand Down
2 changes: 1 addition & 1 deletion open_city_profile/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
csp_exempt(
csrf_exempt(
GraphQLView.as_view(
graphiql=settings.ENABLE_GRAPHIQL or settings.DEBUG,
graphiql=settings.ENABLE_GRAPHIQL,
execution_context_class=DeferredExecutionContext,
)
)
Expand Down
2 changes: 1 addition & 1 deletion open_city_profile/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _run_custom_validators(self, query):
depth_limit_validator(max_depth=settings.GRAPHQL_QUERY_DEPTH_LIMIT)
]

if not settings.ENABLE_GRAPHQL_INTROSPECTION and not settings.DEBUG:
if not settings.ENABLE_GRAPHQL_INTROSPECTION:
validation_rules.append(DisableIntrospection)

try:
Expand Down
Loading