diff --git a/CONFIG.py b/CONFIG.py index dd079fe..314020e 100644 --- a/CONFIG.py +++ b/CONFIG.py @@ -85,6 +85,8 @@ def get_config_file(filename: str): OPEN_API = f"{REST_URL}/static/openapi.yml" +DISABLE_SWAGGER_UI = getenv("DISABLE_SWAGGER_UI", "false").lower().startswith("t") + # Security RPC_LISTEN_ADDRESS = getenv("RPC_LISTEN_ADDRESS", "") NODE_MONIKER = getenv("NODE_MONIKER", "") diff --git a/HELPERS.py b/HELPERS.py index daf7e3d..434d506 100644 --- a/HELPERS.py +++ b/HELPERS.py @@ -1,9 +1,8 @@ import re from os import getenv -import httpx - import CONFIG +import httpx from CONFIG import REDIS_DB from HELPERS_TYPES import CallType, Mode diff --git a/configs/.env b/configs/.env index 4bed052..cfa5ae3 100644 --- a/configs/.env +++ b/configs/.env @@ -25,7 +25,7 @@ RPC_WEBSOCKET="ws://15.204.143.232:26657/websocket" # REST API REST_URL="http://127.0.0.1:1317" BACKUP_REST_URL="https://api.juno.strange.love" - +DISABLE_SWAGGER_UI=false # === Security === # Hides value in the /status endpoint of the RPC diff --git a/rest.py b/rest.py index 93bf0b0..da394ef 100644 --- a/rest.py +++ b/rest.py @@ -2,11 +2,10 @@ import json -from flask import Flask, jsonify, request -from flask_cors import CORS, cross_origin - import CONFIG as CONFIG from CONFIG import REDIS_DB +from flask import Flask, jsonify, request +from flask_cors import CORS, cross_origin from HELPERS import ( Mode, download_openapi_locally, @@ -46,6 +45,9 @@ def before_first_request(): def root(): global REST_SWAGGER_HTML + if CONFIG.DISABLE_SWAGGER_UI: + return jsonify({"code": 12, "message": "Not Implemented", "details": []}) + if len(REST_SWAGGER_HTML) > 0: return REST_SWAGGER_HTML