from configparser import ConfigParser

def load_hosts(
    config_file="configs/hosts.conf"
):
    config = ConfigParser()
    config.read(config_file)
    hosts = []
    for section in config.sections():
        if section == "Local":
            hosts.append(section)
            continue
        host = config.get(
            section,
            "server_address",
            fallback=""
        ).strip()
        if host:
            hosts.append(section)
    return hosts
def get_host_config(
    host_name,
    config_file="configs/hosts.conf"
):
    config = ConfigParser()
    config.read(config_file)
    if host_name not in config:
        return None
    return dict(config[host_name])
