blob: 6a162b859c96d6c018642f13047e8bd2bb020f83 [file] [log] [blame]
import os
# import sys
import yaml
# import argparse
def parse_config(file_name):
with open(file_name) as f:
cfg = yaml.load(f.read())
return cfg
# WTX???
# parser = argparse.ArgumentParser(description="config file name")
# parser.add_argument("-p", "--path")
# parser.add_argument("-b", "--basedir")
# parser.add_argument("-t", "--testpath")
# parser.add_argument("-d", "--database")
# parser.add_argument("-c", "--chartpath")
# config = parser.parse_args(sys.argv[1:])
path = "koder.yaml"
# if config.path is not None:
# path = config.path
cfg_dict = parse_config(path)
# basedir = cfg_dict['paths']['basedir']
# TEST_PATH = cfg_dict['paths']['TEST_PATH']
# SQLALCHEMY_MIGRATE_REPO = cfg_dict['paths']['SQLALCHEMY_MIGRATE_REPO']
# DATABASE_URI = cfg_dict['paths']['DATABASE_URI']
# CHARTS_IMG_PATH = cfg_dict['paths']['CHARTS_IMG_PATH']
# if config.basedir is not None:
# basedir = config.basedir
# if config.testpath is not None:
# TEST_PATH = config.testpath
# if config.database is not None:
# DATABASE_URI = config.database
# if config.chartpath is not None:
# CHARTS_IMG_PATH = config.chartpath