enh(): Adds configurable CORS
* Adds CORS configuration in the config file * Enables CORS to be toggled through config
This commit is contained in:
parent
c036d042c3
commit
35c8dfd21a
2 changed files with 4 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
Server:
|
Server:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
port: 8000
|
port: 8000
|
||||||
|
cors: False
|
||||||
|
|
||||||
Web:
|
Web:
|
||||||
host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
|
|
|
@ -23,7 +23,9 @@ class Web:
|
||||||
def init(self):
|
def init(self):
|
||||||
self.app = Flask(__name__)
|
self.app = Flask(__name__)
|
||||||
self.setup_routes()
|
self.setup_routes()
|
||||||
CORS(self.app)
|
if server_config and server_config.get("cors", False):
|
||||||
|
self.logger.debug("Enabling CORS...")
|
||||||
|
CORS(self.app)
|
||||||
|
|
||||||
def setup_routes(self):
|
def setup_routes(self):
|
||||||
self.app.add_url_rule("/", "/", self.handler.index, methods=["GET"])
|
self.app.add_url_rule("/", "/", self.handler.index, methods=["GET"])
|
||||||
|
|
Loading…
Reference in a new issue