Merge pull request #3520 from freqtrade/rpc/cors_setting

Fix RPC Cors
This commit is contained in:
Matthias
2020-06-27 15:38:40 +02:00
committed by GitHub
9 changed files with 40 additions and 5 deletions

View File

@@ -222,6 +222,8 @@ CONF_SCHEMA = {
},
'username': {'type': 'string'},
'password': {'type': 'string'},
'jwt_secret_key': {'type': 'string'},
'CORS_origins': {'type': 'array', 'items': {'type': 'string'}},
'verbosity': {'type': 'string', 'enum': ['error', 'info']},
},
'required': ['enabled', 'listen_ip_address', 'listen_port', 'username', 'password']

View File

@@ -90,7 +90,9 @@ class ApiServer(RPC):
self._config = freqtrade.config
self.app = Flask(__name__)
self._cors = CORS(self.app,
resources={r"/api/*": {"supports_credentials": True, }}
resources={r"/api/*": {
"supports_credentials": True,
"origins": self._config['api_server'].get('CORS_origins', [])}}
)
# Setup the Flask-JWT-Extended extension

View File

@@ -59,6 +59,7 @@
"listen_port": 8080,
"verbosity": "info",
"jwt_secret_key": "somethingrandom",
"CORS_origins": [],
"username": "",
"password": ""
},