diff options
author | Daniil Baturin <daniil@vyos.io> | 2022-03-27 11:36:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-27 11:36:55 +0300 |
commit | 5ad305087e4a3c710d35be04b14dd30ddd051eaf (patch) | |
tree | 68d52759cb98d471e40dff65714daf497d9c2ece | |
parent | 2cfbb51731eb24c80bd4d697e370dde4972400a5 (diff) | |
parent | 9d3acc2b55f2d1c563f1941e59c98c159211dc58 (diff) | |
download | vyos-1x-5ad305087e4a3c710d35be04b14dd30ddd051eaf.tar.gz vyos-1x-5ad305087e4a3c710d35be04b14dd30ddd051eaf.zip |
Merge pull request #1253 from jestabro/gql-test-node
graphql: T3993: add unsettable gql option; this is not exposed by CLI
-rw-r--r-- | python/vyos/defaults.py | 1 | ||||
-rwxr-xr-x | src/conf_mode/http-api.py | 9 | ||||
-rwxr-xr-x | src/services/vyos-http-api-server | 4 |
3 files changed, 13 insertions, 1 deletions
diff --git a/python/vyos/defaults.py b/python/vyos/defaults.py index c77b695bd..fcb6a7fbc 100644 --- a/python/vyos/defaults.py +++ b/python/vyos/defaults.py @@ -48,6 +48,7 @@ api_data = { 'port' : '8080', 'socket' : False, 'strict' : False, + 'gql' : False, 'debug' : False, 'api_keys' : [ {"id": "testapp", "key": "qwerty"} ] } diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py index b5f5e919f..00f3d4f7f 100755 --- a/src/conf_mode/http-api.py +++ b/src/conf_mode/http-api.py @@ -66,6 +66,15 @@ def get_config(config=None): if conf.exists('debug'): http_api['debug'] = True + # this node is not available by CLI by default, and is reserved for + # the graphql tools. One can enable it for testing, with the warning + # that this will open an unauthenticated server. To do so + # mkdir /opt/vyatta/share/vyatta-cfg/templates/service/https/api/gql + # touch /opt/vyatta/share/vyatta-cfg/templates/service/https/api/gql/node.def + # and configure; editing the config alone is insufficient. + if conf.exists('gql'): + http_api['gql'] = True + if conf.exists('socket'): http_api['socket'] = True diff --git a/src/services/vyos-http-api-server b/src/services/vyos-http-api-server index 06871f1d6..1000d8b72 100755 --- a/src/services/vyos-http-api-server +++ b/src/services/vyos-http-api-server @@ -648,10 +648,12 @@ if __name__ == '__main__': app.state.vyos_keys = server_config['api_keys'] app.state.vyos_debug = server_config['debug'] + app.state.vyos_gql = server_config['gql'] app.state.vyos_strict = server_config['strict'] app.state.vyos_origins = server_config.get('cors', {}).get('origins', []) - graphql_init(app) + if app.state.vyos_gql: + graphql_init(app) try: if not server_config['socket']: |