diff --git a/config/config.yaml b/config/config.yaml index aaddc77..93bfec7 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -1,6 +1,7 @@ Server: host: 127.0.0.1 port: 8000 + cors: False Web: host: 127.0.0.1 diff --git a/shortenit/web.py b/shortenit/web.py index 17b11d2..25a8030 100644 --- a/shortenit/web.py +++ b/shortenit/web.py @@ -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"])