Skip to content

Commit

Permalink
Add CORS support in API
Browse files Browse the repository at this point in the history
  • Loading branch information
Marta Gómez Macías committed Feb 19, 2019
1 parent 4d6660f commit 1913196
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/scripts/wazuh-apid.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import yaml

import connexion
from flask_cors import CORS

from api import encoder
from wazuh import common, pyDaemonModule, Wazuh
Expand Down Expand Up @@ -88,7 +89,9 @@ def main(configuration):
app = connexion.App(__name__, specification_dir=f'{common.ossec_path}/api/api/spec/')
app.app.json_encoder = encoder.JSONEncoder
app.add_api('spec.yaml', arguments={'title': 'Wazuh API'})
app.run(port=8080)
if configuration['cors']:
# add CORS support
CORS(app.app)
app.run(port=configuration['port'], host=configuration['host'])


Expand Down
2 changes: 2 additions & 0 deletions framework/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ requests==2.21.0
uvloop==0.11.3
PyYAML==3.13
connexion==2.2.0
Flask-Cors==3.0.7
Flask==1.0.2

0 comments on commit 1913196

Please sign in to comment.