File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change 88SERVER_NAME = os .getenv (
99 'SERVER_NAME' , 'localhost:{0}' .format (os .getenv ('PORT' , '8000' )))
1010
11+ ENV = os .getenv ('FLASK_ENV' , 'production' )
12+
1113# MongoDB configuration
1214MONGODB_SETTINGS = {
1315 'db' : os .getenv ('MONGODB_DB' , 'sqrl' ),
Original file line number Diff line number Diff line change 11from flask import Flask
22from graphql_server .flask import GraphQLView
3-
3+ from graphql .validation .rules .custom .no_schema_introspection import NoSchemaIntrospectionCustomRule
4+ from graphql .validation .specified_rules import specified_rules
45from sqrl .graphql .schema import schema
56
67
78def init_app (app : Flask ) -> None :
89 """Initialise GraphQL with a flask app context."""
10+ on_dev = app .config .get ('ENV' , 'production' ) == 'development'
11+ prod_rules = specified_rules + tuple ([NoSchemaIntrospectionCustomRule ])
912 app .add_url_rule (
1013 '/graphql' ,
1114 view_func = GraphQLView .as_view (
1215 'graphql' ,
1316 schema = schema .graphql_schema ,
14- graphiql = True ),
17+ validation_rules = None if on_dev else prod_rules ,
18+ graphiql = on_dev ,
19+ )
1520 )
You can’t perform that action at this time.
0 commit comments