diff options
| author | John Estabrook <jestabro@vyos.io> | 2022-10-23 11:07:46 -0500 | 
|---|---|---|
| committer | John Estabrook <jestabro@vyos.io> | 2022-10-25 10:35:48 -0500 | 
| commit | af56ddf4615974c6b5f5886520d6abb0781cea80 (patch) | |
| tree | 3615850297850c792f5804621d4d83652c8023f5 /src/services/vyos-http-api-server | |
| parent | f76a6f68b08fce1feee2dbbb84658b8eede09655 (diff) | |
| download | vyos-1x-af56ddf4615974c6b5f5886520d6abb0781cea80.tar.gz vyos-1x-af56ddf4615974c6b5f5886520d6abb0781cea80.zip | |
graphql: T4574: read config and generate schema with/without key auth
Diffstat (limited to 'src/services/vyos-http-api-server')
| -rwxr-xr-x | src/services/vyos-http-api-server | 15 | 
1 files changed, 9 insertions, 6 deletions
| diff --git a/src/services/vyos-http-api-server b/src/services/vyos-http-api-server index 632c1e87d..7a35546e5 100755 --- a/src/services/vyos-http-api-server +++ b/src/services/vyos-http-api-server @@ -647,11 +647,11 @@ def reset_op(data: ResetModel):  ###  def graphql_init(fast_api_app): -    from api.graphql.bindings import generate_schema -      api.graphql.state.init()      api.graphql.state.settings['app'] = app +    # import after initializaion of state +    from api.graphql.bindings import generate_schema      schema = generate_schema()      in_spec = app.state.vyos_introspection @@ -690,10 +690,13 @@ if __name__ == '__main__':      app.state.vyos_origins = server_config.get('cors', {}).get('allow_origin', [])      if 'graphql' in server_config:          app.state.vyos_graphql = True -        if isinstance(server_config['graphql'], dict) and 'introspection' in server_config['graphql']: -            app.state.vyos_introspection = True -        else: -            app.state.vyos_introspection = False +        if isinstance(server_config['graphql'], dict): +            if 'introspection' in server_config['graphql']: +                app.state.vyos_introspection = True +            else: +                app.state.vyos_introspection = False +            # default value is merged in conf_mode http-api.py, if not set +            app.state.vyos_auth_type = server_config['graphql']['authentication']['type']      else:          app.state.vyos_graphql = False | 
