Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Reecepbcups/python-rpc-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Feb 20, 2023
2 parents 29fb375 + c637157 commit 2113b40
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CONFIG.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")
Expand Down
3 changes: 1 addition & 2 deletions HELPERS.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion configs/.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 2113b40

Please sign in to comment.