blob: 6a162b859c96d6c018642f13047e8bd2bb020f83 [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:])
koder aka kdanilovda45e882015-04-06 02:24:42 +030023path = "koder.yaml"
gstepanov5f936df2015-03-18 19:15:59 +020024
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
koder aka kdanilovda45e882015-04-06 02:24:42 +030028cfg_dict = parse_config(path)
29# basedir = cfg_dict['paths']['basedir']
30# TEST_PATH = cfg_dict['paths']['TEST_PATH']
31# SQLALCHEMY_MIGRATE_REPO = cfg_dict['paths']['SQLALCHEMY_MIGRATE_REPO']
32# DATABASE_URI = cfg_dict['paths']['DATABASE_URI']
33# CHARTS_IMG_PATH = cfg_dict['paths']['CHARTS_IMG_PATH']
gstepanov5f936df2015-03-18 19:15:59 +020034
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