Beispiel #1
0
def init():
    """Initializes configuration.

    """
    global data

    # Escape if config data already initialized.
    if data is not None:
        return

    # Attempt to load config.
    config_path = _init_from_local_config() or \
                  _init_from_user_home() or \
                  _init_from_shell_config()

    if not config_path:
        raise RuntimeError("""
            WARNING :: pyesdoc configuration file not found.
            If running pyesdoc within ES-DOC shell the config file location should be:
                SHELL-HOME/ops/config/pyesdoc.conf.
            If running pyesdoc in standalone mode the config file location should be:
                $HOME/.pyesdoc
            Otherwise:
                1.  Download the following default configuration file:
                    http://bit.ly/2g3NUmQ
                2.  Copy downloaded file to $HOME/.pyesdoc
            If this problem persists them contact [email protected]
        """)

    log("Loading pyesdoc config from: {}".format(config_path))
    data = json_file_to_namedtuple(config_path)
def _log(msg):
    """Logging helper function.

    """
    runtime.log(msg)