-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
executable file
·46 lines (33 loc) · 1.23 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
@author: fabiomignini
@author: stefanopetrangeli
@author: gabrielecastellano
"""
import logging
import os
import inspect
from threading import Thread
from flask import Flask
from orchestrator_core.api.api import root_blueprint
from orchestrator_core.api.nffg import api as nffg_api
from orchestrator_core.api.user import api as user_api
from orchestrator_core.config import Configuration
from orchestrator_core.dd_client import DDClient
# load configuration
conf = Configuration()
# initialize logging
conf.log_configuration()
print("[ Configuration file is: '" + Configuration().conf_file + "' ]")
logging.debug("Global Orchestrator Starting...")
# Rest application
if nffg_api is not None and user_api is not None:
app = Flask(__name__)
app.register_blueprint(root_blueprint)
logging.info("Flask Successfully started")
# start the dd client to receive information about domains
base_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]))
dd_server = DDClient(conf.DD_NAME, conf.BROKER_ADDRESS, conf.DD_CUSTOMER, conf.DD_KEYFILE)
thread = Thread(target=dd_server.start)
thread.start()
logging.info("DoubleDecker Successfully started")
print("Welcome to the Global Orchestrator")