chg: [backend:config] Added server and zmq settings as variables

This commit is contained in:
Sami Mokaddem 2024-07-01 15:02:19 +02:00
parent 4b2e876945
commit 851da1fd97
2 changed files with 7 additions and 2 deletions

View file

@ -1,4 +1,8 @@
server_host = '0.0.0.0'
server_port = 4000
zmq_url = 'tcp://localhost:50000'
misp_url = 'https://localhost/'
misp_apikey = 'FI4gCRghRZvLVjlLPLTFZ852x2njkkgPSz0zQ3E0'
misp_skipssl = True

View file

@ -11,6 +11,7 @@ from eventlet.green import zmq as gzmq
import exercise as exercise_model
import notification as notification_model
import db
import config
import misp_api
@ -20,7 +21,7 @@ ZMQ_MESSAGE_COUNT = 0
# Initialize ZeroMQ context and subscriber socket
context = gzmq.Context()
zsocket = context.socket(gzmq.SUB)
zmq_url = "tcp://localhost:50000" # Update this with your zmq publisher address
zmq_url = config.zmq_url
zsocket.connect(zmq_url)
zsocket.setsockopt_string(gzmq.SUBSCRIBE, '')
@ -166,4 +167,4 @@ if __name__ == "__main__":
eventlet.spawn_n(forward_zmq_to_socketio)
# Run the Socket.IO server
eventlet.wsgi.server(eventlet.listen(('0.0.0.0', 3000)), app)
eventlet.wsgi.server(eventlet.listen((config.server_host, config.server_port)), app)