mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
plugins/clnrest: Update App server to dynamically add CORS settings
This commit is contained in:
parent
632e7abd05
commit
b0430cc897
1 changed files with 3 additions and 0 deletions
|
@ -11,6 +11,7 @@ try:
|
|||
from pathlib import Path
|
||||
from flask import Flask, request
|
||||
from flask_restx import Api
|
||||
from flask_cors import CORS
|
||||
from gunicorn.app.base import BaseApplication
|
||||
from multiprocessing import Process, Queue
|
||||
from flask_socketio import SocketIO, disconnect
|
||||
|
@ -79,11 +80,13 @@ def ws_connect():
|
|||
|
||||
|
||||
def create_app():
|
||||
from utilities.shared import REST_CORS_ORIGINS
|
||||
global app
|
||||
app.config['SECRET_KEY'] = os.urandom(24).hex()
|
||||
authorizations = {
|
||||
"rune": {"type": "apiKey", "in": "header", "name": "Rune"}
|
||||
}
|
||||
CORS(app, resources={r"/*": {"origins": REST_CORS_ORIGINS}})
|
||||
api = Api(app, version="1.0", title="Core Lightning Rest", description="Core Lightning REST API Swagger", authorizations=authorizations, security=["rune"])
|
||||
api.add_namespace(rpcns, path="/v1")
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue