# Path: app/__metadata__.py
# APP_NAME = 'LXDUI'
# APP_CLI_CMD = 'lxdui'
# VERSION = '2.2'
# GIT_URL = 'https://github.com/AdaptiveScale/lxdui.git'
# LXD_URL = 'http://localhost:8443'
# LICENSE = 'Apache 2.0'
# AUTHOR = 'AdaptiveScale, Inc.'
# AUTHOR_URL = 'http://www.adaptivescale.com'
# AUTHOR_EMAIL = 'info@adaptivescale.com'
# KEYWORDS = 'lxc lxc-containers lxd'
# IMAGE_HUB = 'http://hub.kuti.io'
# AUTO_LOAD_CONFIG = True
# DEFAULT_CONFIG_FORMAT = 'ini'


from app import __metadata__ as meta
from configparser import ConfigParser, ExtendedInterpolation
from pathlib import Path
from shutil import copy
import os
import io
import logging
        Initialises the Config object and loads the configuration into memory.

          Order of operations:
            1) if a config file has been provided then use that one
            2) check to see if we have a local config file, and if so use that
            3) no config file found so we'll create one with defaults

        :param kwargs: conf=</path/to/config/file> #External source
        """
        m = MetaConf()

        self.config = None
        self.log_file = m.log_file
        self.config_file = m.config_file

        # conf file specified by the caller
        if kwargs:
            file = kwargs.get('conf')
            log.info('Loading external config file: {}'.format(file))
            if file:
                self.config = self.load('external', file)
                self.envSet(log=self.log_file, conf=file)
            else:
                raise Exception('Unsupported parameter {}'.format(kwargs))
        # no conf parameters specified so check local conf file
        elif Path(self.config_file).exists():
            log.info('Using config file path = {}'.format(self.config_file))
            self.config = self.load('ini', self.config_file)
            self.envSet()
        # load the default config from meta

# Path: app/__metadata__.py
# APP_NAME = 'LXDUI'
# APP_CLI_CMD = 'lxdui'
# VERSION = '2.2'
# GIT_URL = 'https://github.com/AdaptiveScale/lxdui.git'
# LXD_URL = 'http://localhost:8443'
# LICENSE = 'Apache 2.0'
# AUTHOR = 'AdaptiveScale, Inc.'
# AUTHOR_URL = 'http://www.adaptivescale.com'
# AUTHOR_EMAIL = 'info@adaptivescale.com'
# KEYWORDS = 'lxc lxc-containers lxd'
# IMAGE_HUB = 'http://hub.kuti.io'
# AUTO_LOAD_CONFIG = True
# DEFAULT_CONFIG_FORMAT = 'ini'


# Path: app/lib/conf.py
from app import __metadata__ as meta
from configparser import ConfigParser, ExtendedInterpolation
from pathlib import Path
from shutil import copy
import os
import io
import logging

        Initialises the Config object and loads the configuration into memory.

          Order of operations:
            1) if a config file has been provided then use that one
            2) check to see if we have a local config file, and if so use that
            3) no config file found so we'll create one with defaults

        :param kwargs: conf=</path/to/config/file> #External source
        """
        m = MetaConf()

        self.config = None
        self.log_file = m.log_file
        self.config_file = m.config_file

        # conf file specified by the caller
        if kwargs:
            file = kwargs.get('conf')
            log.info('Loading external config file: {}'.format(file))
            if file:
                self.config = self.load('external', file)
                self.envSet(log=self.log_file, conf=file)
            else:
                raise Exception('Unsupported parameter {}'.format(kwargs))
        # no conf parameters specified so check local conf file
        elif Path(self.config_file).exists():
            log.info('Using config file path = {}'.format(self.config_file))
            self.config = self.load('ini', self.config_file)
            self.envSet()
        # load the default config from meta

        elif meta.AUTO_LOAD_CONFIG: