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