Skip to content

Commit

Permalink
Disable introspection on prod sizing
Browse files Browse the repository at this point in the history
  • Loading branch information
noah-paige committed Nov 19, 2024
1 parent 64da618 commit 0941dc2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion backend/api_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from dataall.base.db import get_engine
from dataall.base.loader import load_modules, ImportMode

from graphql.pyutils import did_you_mean

logger = logging.getLogger()
logger.setLevel(os.environ.get('LOG_LEVEL', 'INFO'))
Expand All @@ -32,6 +33,11 @@
for name in ['boto3', 's3transfer', 'botocore', 'boto']:
logging.getLogger(name).setLevel(logging.ERROR)

SCHEMA_EXPLORATION = True if os.getenv('SCHEMA_EXPLORATION') == 'True' else False

if SCHEMA_EXPLORATION:
did_you_mean.__globals__['MAX_LENGTH'] = 0

load_modules(modes={ImportMode.API})
SCHEMA = bootstrap_schema()
TYPE_DEFS = gql(SCHEMA.gql(with_directives=False))
Expand Down Expand Up @@ -138,7 +144,9 @@ def handler(event, context):
else:
raise Exception(f'Could not initialize user context from event {event}')

success, response = graphql_sync(schema=executable_schema, data=query, context_value=app_context)
success, response = graphql_sync(
schema=executable_schema, data=query, context_value=app_context, introspection=SCHEMA_EXPLORATION
)

dispose_context()
response = json.dumps(response)
Expand Down
1 change: 1 addition & 0 deletions deploy/stacks/lambda_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def __init__(
'LOG_LEVEL': log_level,
'REAUTH_TTL': str(reauth_ttl),
'ALLOWED_ORIGINS': allowed_origins,
'SCHEMA_EXPLORATION': str(prod_sizing),
}
# Check if custom domain exists and if it exists email notifications could be enabled. Create a env variable which stores the domain url. This is used for sending data.all share weblinks in the email notifications.
if custom_domain and custom_domain.get('hosted_zone_name', None):
Expand Down

0 comments on commit 0941dc2

Please sign in to comment.