summaryrefslogtreecommitdiff
path: root/kvmd/application.py
blob: 3db8d20d69205fa648e6503493ad1bbbd52e22cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import argparse
import logging
import logging.config

from typing import Dict

from .yaml import load_yaml_file


# =====
def init() -> Dict:
    parser = argparse.ArgumentParser()
    parser.add_argument("-c", "--config", required=True, metavar="<path>")
    options = parser.parse_args()

    config: Dict = load_yaml_file(options.config)

    logging.captureWarnings(True)
    logging.config.dictConfig(config["logging"])

    return config