# Path: lib/settings.py
# def get_top_domains(dbname):


from configparser import SafeConfigParser
from lib.logger import *
from lib.settings import homenet, lock
import threading
import os
import time
import lib.utils as utils
import netifaces


class CheckConfigFileModification(threading.Thread):
    def __init__(self, threadID):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self._cached_stamp_core = 0
        self._cached_stamp_user = 0
        self.core_conf_file = 'config.ini'
        self.user_conf_file = 'html/user_config.ini'

    def run(self):

        counter = 0
        while 1:
            flag = False
            stamp = os.stat(self.core_conf_file).st_mtime
            if stamp != self._cached_stamp_core:
                flag = True
                self._cached_stamp_core = stamp
                # Reading core configuration file
                core_config = SafeConfigParser()
                core_config.read('config.ini')

                # main section
                with lock:
                    homenet.interface = core_config.get('main', 'iface')

# Path: lib/settings.py
# def get_top_domains(dbname):


# Path: lib/config.py
from configparser import SafeConfigParser
from lib.logger import *
from lib.settings import homenet, lock
import threading
import os
import time
import lib.utils as utils
import netifaces



class CheckConfigFileModification(threading.Thread):
    def __init__(self, threadID):
        threading.Thread.__init__(self)
        self.threadID = threadID
        self._cached_stamp_core = 0
        self._cached_stamp_user = 0
        self.core_conf_file = 'config.ini'
        self.user_conf_file = 'html/user_config.ini'

    def run(self):

        counter = 0
        while 1:
            flag = False
            stamp = os.stat(self.core_conf_file).st_mtime
            if stamp != self._cached_stamp_core:
                flag = True
                self._cached_stamp_core = stamp
                # Reading core configuration file
                core_config = SafeConfigParser()
                core_config.read('config.ini')

                # main section
                with lock:
                    homenet.interface = core_config.get('main', 'iface')

                    homenet.fg_intel_creds = core_config.get('api_urls', 'fg_intel_creds').strip('"')