Skip to content

Commit

Permalink
fixed config location read
Browse files Browse the repository at this point in the history
  • Loading branch information
darthbear committed Apr 29, 2015
1 parent bcbb0c0 commit 8b5a340
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion catdb/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import argparse
import json
import os
from pyhocon import ConfigFactory
import sys
from catdb import CatDbException
from catdb.db import DbManager


Expand All @@ -24,7 +26,13 @@ def main():
subparsers.add_parser('list', help='list', parents=[parent_parser])

args = argparser.parse_args()
config = ConfigFactory.parse_file('.catdb')
home_dir = os.environ['HOME']
config_path = os.path.join(home_dir, '.catdb')
if not os.path.exists(config_path):
sys.stderr.write('File {config_path} not found. Go to https://github.com/chimpler/catdb for more details\n'.format(config_path=config_path))
sys.exit(1)

config = ConfigFactory.parse_file(config_path)
db_config = config['databases.' + args.database]

db = DbManager.get_db(db_config['type'], db_config)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def run_tests(self):

setup(
name='catdb',
version='0.0.1',
version='0.0.2',
description='Utility to copy data from various databases',
long_description='Utility to import, export and copy data from various databases',
keywords='catdb',
Expand Down

0 comments on commit 8b5a340

Please sign in to comment.