# Path: alignak_app/utils/system.py
# def read_config_file(cfg_parser, filename):
#     """
#     Read configuration file and assign it to configParser object
# 
#     :param cfg_parser: configparser object
#     :type cfg_parser: configparser.ConfigParser
#     :param filename: name of file to read
#     :type filename: str
#     :return: corresponding filename if read is success
#     :rtype: str
#     """
# 
#     try:
#         cfg_file = cfg_parser.read(filename)
#         if cfg_file:
#             return cfg_file[0]
#     except (DuplicateOptionError, DuplicateSectionError) as d:  # pragma: no cover
#         print('Duplicate Option/Section in file [%s] !' % filename)
#         sys.exit(d)
#     except Exception as ex:  # pragma: no cover - not testable
#         print('Configuration file [%s] is missing !' % filename)
#         sys.exit(ex)
# 
#     return None


import os
import webbrowser
import configparser
from logging import getLogger
from configparser import NoOptionError, NoSectionError, InterpolationError
from alignak_app.utils.system import read_config_file
            'update_dashboard': 30,
            'update_host': 30,
            'update_service': 30,
            'update_problems': 30,
        },
        'Log': {
            'filename': 'alignakapp',
            'debug': True
        }
    }

    def __init__(self):
        self.app_config = configparser.ConfigParser(os.environ)
        self.img_config = configparser.ConfigParser()
        self.css_style = ''
        self.settings = {
            'settings': '',
            'images': ''
        }

    def init_config(self):
        """
        Initialize configurations

        """

        settings_cfg = '%s/settings.cfg' % os.environ['ALIGNAKAPP_USR_DIR']
        images_ini = '%s/images.ini' % os.environ['ALIGNAKAPP_APP_DIR']

        self.settings['settings'] = read_config_file(self.app_config, settings_cfg)

# Path: alignak_app/utils/system.py
# def read_config_file(cfg_parser, filename):
#     """
#     Read configuration file and assign it to configParser object
# 
#     :param cfg_parser: configparser object
#     :type cfg_parser: configparser.ConfigParser
#     :param filename: name of file to read
#     :type filename: str
#     :return: corresponding filename if read is success
#     :rtype: str
#     """
# 
#     try:
#         cfg_file = cfg_parser.read(filename)
#         if cfg_file:
#             return cfg_file[0]
#     except (DuplicateOptionError, DuplicateSectionError) as d:  # pragma: no cover
#         print('Duplicate Option/Section in file [%s] !' % filename)
#         sys.exit(d)
#     except Exception as ex:  # pragma: no cover - not testable
#         print('Configuration file [%s] is missing !' % filename)
#         sys.exit(ex)
# 
#     return None


# Path: alignak_app/utils/config.py
import os
import webbrowser
import configparser
from logging import getLogger
from configparser import NoOptionError, NoSectionError, InterpolationError
from alignak_app.utils.system import read_config_file

            'update_dashboard': 30,
            'update_host': 30,
            'update_service': 30,
            'update_problems': 30,
        },
        'Log': {
            'filename': 'alignakapp',
            'debug': True
        }
    }

    def __init__(self):
        self.app_config = configparser.ConfigParser(os.environ)
        self.img_config = configparser.ConfigParser()
        self.css_style = ''
        self.settings = {
            'settings': '',
            'images': ''
        }

    def init_config(self):
        """
        Initialize configurations

        """

        settings_cfg = '%s/settings.cfg' % os.environ['ALIGNAKAPP_USR_DIR']
        images_ini = '%s/images.ini' % os.environ['ALIGNAKAPP_APP_DIR']

        self.settings['settings'] = read_config_file(self.app_config, settings_cfg)

        self.settings['images'] = read_config_file(self.img_config, images_ini)