blob: a33f9b59b4913a36a442c8a422689c5ef4e3d36e [file] [log] [blame]
gstepanov725cc302015-02-09 15:08:06 +02001import os
koder aka kdanilove06762a2015-03-22 23:32:09 +02002# import sys
3import yaml
4# import argparse
gstepanov725cc302015-02-09 15:08:06 +02005
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
koder aka kdanilove06762a2015-03-22 23:32:09 +020014# WTX???
15# parser = argparse.ArgumentParser(description="config file name")
16# parser.add_argument("-p", "--path")
17# parser.add_argument("-b", "--basedir")
18# parser.add_argument("-t", "--testpath")
19# parser.add_argument("-d", "--database")
20# parser.add_argument("-c", "--chartpath")
gstepanov5f936df2015-03-18 19:15:59 +020021
koder aka kdanilove06762a2015-03-22 23:32:09 +020022# config = parser.parse_args(sys.argv[1:])
gstepanov5f936df2015-03-18 19:15:59 +020023path = "config.yaml"
24
koder aka kdanilove06762a2015-03-22 23:32:09 +020025# if config.path is not None:
26# path = config.path
gstepanov5f936df2015-03-18 19:15:59 +020027
28cfg_dict = parse_config(os.path.join(os.path.dirname(__file__), path))
gstepanovc82391e2015-03-17 15:46:36 +020029basedir = cfg_dict['paths']['basedir']
30TEST_PATH = cfg_dict['paths']['TEST_PATH']
31SQLALCHEMY_MIGRATE_REPO = cfg_dict['paths']['SQLALCHEMY_MIGRATE_REPO']
32DATABASE_URI = cfg_dict['paths']['DATABASE_URI']
gstepanov5f936df2015-03-18 19:15:59 +020033CHARTS_IMG_PATH = cfg_dict['paths']['CHARTS_IMG_PATH']
34
koder aka kdanilove06762a2015-03-22 23:32:09 +020035# if config.basedir is not None:
36# basedir = config.basedir
gstepanovb3c78962015-03-20 15:47:58 +020037
koder aka kdanilove06762a2015-03-22 23:32:09 +020038# if config.testpath is not None:
39# TEST_PATH = config.testpath
gstepanovb3c78962015-03-20 15:47:58 +020040
koder aka kdanilove06762a2015-03-22 23:32:09 +020041# if config.database is not None:
42# DATABASE_URI = config.database
gstepanovb3c78962015-03-20 15:47:58 +020043
koder aka kdanilove06762a2015-03-22 23:32:09 +020044# if config.chartpath is not None:
45# CHARTS_IMG_PATH = config.chartpath