blob: e77058f943ecbe3149d633b322f0a357d98c7751 [file] [log] [blame]
gstepanov5f936df2015-03-18 19:15:59 +02001import argparse
2import sys
gstepanovc82391e2015-03-17 15:46:36 +02003import yaml
gstepanov725cc302015-02-09 15:08:06 +02004import os
5
stgleb75c70412015-02-17 02:52:00 +02006
gstepanovc82391e2015-03-17 15:46:36 +02007def parse_config(file_name):
8 with open(file_name) as f:
9 cfg = yaml.load(f.read())
10
11 return cfg
12
13
gstepanov5f936df2015-03-18 19:15:59 +020014parser = argparse.ArgumentParser(description="config file name")
15parser.add_argument("-p", "--path")
16
17config = parser.parse_args(sys.argv[1:])
18path = "config.yaml"
19
20if not config.path is None:
21 path = config.path
22
23cfg_dict = parse_config(os.path.join(os.path.dirname(__file__), path))
gstepanovc82391e2015-03-17 15:46:36 +020024basedir = cfg_dict['paths']['basedir']
25TEST_PATH = cfg_dict['paths']['TEST_PATH']
26SQLALCHEMY_MIGRATE_REPO = cfg_dict['paths']['SQLALCHEMY_MIGRATE_REPO']
27DATABASE_URI = cfg_dict['paths']['DATABASE_URI']
gstepanov5f936df2015-03-18 19:15:59 +020028CHARTS_IMG_PATH = cfg_dict['paths']['CHARTS_IMG_PATH']
29
30