#!/usr/bin/env python

"""
This will work in development on a relative folder basis
It will then work when installed in site-packages on a target system
where the runner script is in /usr/bin (or wherever)
"""
from sdk.softfire.main import start_manager
from eu.softfire.sec.SecurityManager import SecurityManager, UpdateStatusThread
import eu.softfire.sec.Api as api
from multiprocessing import Process

import asyncio
from concurrent.futures import ProcessPoolExecutor
import os
from eu.softfire.sec.utils.utils import config_path, get_config

def start():
    os.environ["http_proxy"] = ""

    local_files_path = get_config("local-files", "path", config_path)
    tmp_files_path = "%s/tmp" % local_files_path
    if not os.path.exists(local_files_path):
        os.makedirs(local_files_path)
    if not os.path.exists(tmp_files_path):
        os.makedirs(tmp_files_path)

    sec_manager = SecurityManager(config_path)
    thread = UpdateStatusThread(sec_manager)
    thread.start()
    api.StartThread().start()

    start_manager(sec_manager)


if __name__ == '__main__':
    start()

