Exemplo n.º 1
0
def main(args=None):
    '''
    If args is None, sys.argv will be used instead
    If args is a list, it will be used instead of sys.argv (for unit testing)
    '''
    options = parse_program_options(args)
    global_config_dir = policies.global_config_dir()
    global_config, channel_config_loader = _get_de_conf_manager(
        global_config_dir, policies.channel_config_dir(), options)
    try:
        _start_de_server(global_config, channel_config_loader)
    except Exception as e:  # pragma: no cover
        msg = f"""Config Dir: {global_config_dir}
              Fatal Error: {e}"""
        print(msg, file=sys.stderr)
        sys.exit(msg)
def main(args=None):
    '''
    If args is None, sys.argv will be used instead
    If args is a list, it will be used instead of sys.argv (for unit testing)
    '''
    options = parse_program_options(args)
    global_config_dir = policies.global_config_dir()
    global_config, channel_config_loader = _get_de_conf_manager(global_config_dir,
                                                                policies.channel_config_dir(),
                                                                options)
    try:
        _start_de_server(global_config, channel_config_loader)
    except Exception as e:
        sys.exit("Server Address: {}\n".format(global_config.get('server_address')) +
                 "Config Dir: {}\n".format(global_config_dir) +
                 "Fatal Error: {}\n".format(e))
Exemplo n.º 3
0
def test_global_config_dir(tmp_path, monkeypatch):
    de_config = tmp_path
    monkeypatch.setenv('CONFIG_PATH', str(de_config))
    global_config_dir = policies.global_config_dir()
    assert de_config == global_config_dir