From 50cfac857e530dbd3f79f6abebbfe0e78706aabd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Wed, 20 Aug 2014 16:00:56 +0200 Subject: [PATCH] Update config Make all paths in the config file relative to the home directory. --- bin/ZMQ_Feed.py | 2 +- bin/ZMQ_Sub_Curve.py | 7 +++++-- bin/ZMQ_Sub_Duplicate.py | 2 +- bin/indexer_lookup.py | 2 +- bin/packages/config.cfg.sample | 8 ++++---- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bin/ZMQ_Feed.py b/bin/ZMQ_Feed.py index eeee987e..1587bb45 100755 --- a/bin/ZMQ_Feed.py +++ b/bin/ZMQ_Feed.py @@ -67,7 +67,7 @@ if __name__ == "__main__": time.sleep(10) continue # Creating the full filepath - filename = os.path.join(os.environ('AIL_BIN'), + filename = os.path.join(os.environ('AIL_HOME'), h.config.get("Directories", "pastes"), paste) dirname = os.path.dirname(filename) if not os.path.exists(dirname): diff --git a/bin/ZMQ_Sub_Curve.py b/bin/ZMQ_Sub_Curve.py index 5a0b94e1..acb2a167 100755 --- a/bin/ZMQ_Sub_Curve.py +++ b/bin/ZMQ_Sub_Curve.py @@ -27,6 +27,7 @@ import time from packages import Paste from pubsublogger import publisher from packages import lib_words +import os import Helper @@ -52,8 +53,10 @@ if __name__ == "__main__": publisher.info("Script Curve subscribed to {}".format(h.sub_channel)) # FILE CURVE SECTION # - csv_path = h.config.get("Directories", "wordtrending_csv") - wordfile_path = h.config.get("Directories", "wordsfile") + csv_path = os.path.join(os.environ('AIL_HOME'), + h.config.get("Directories", "wordtrending_csv")) + wordfile_path = os.path.join(os.environ('AIL_HOME'), + h.config.get("Directories", "wordsfile")) message = h.redis_rpop() prec_filename = None diff --git a/bin/ZMQ_Sub_Duplicate.py b/bin/ZMQ_Sub_Duplicate.py index ccaf6f7d..dc185530 100755 --- a/bin/ZMQ_Sub_Duplicate.py +++ b/bin/ZMQ_Sub_Duplicate.py @@ -54,7 +54,7 @@ if __name__ == "__main__": h.config.get("PubSub_Global", "channel"))) set_limit = 100 - bloompath = os.path.join(os.environ('AIL_BIN'), + bloompath = os.path.join(os.environ('AIL_HOME'), h.config.get("Directories", "bloomfilters")) bloop_path_set = set() diff --git a/bin/indexer_lookup.py b/bin/indexer_lookup.py index d89b0155..3a239f13 100644 --- a/bin/indexer_lookup.py +++ b/bin/indexer_lookup.py @@ -27,7 +27,7 @@ cfg = ConfigParser.ConfigParser() cfg.read(configfile) # Indexer configuration - index dir and schema setup -indexpath = cfg.get("Indexer", "path") +indexpath = os.path.join(os.environ('AIL_HOME'), cfg.get("Indexer", "path")) indexertype = cfg.get("Indexer", "type") argParser = argparse.ArgumentParser(description='Fulltext search for AIL') diff --git a/bin/packages/config.cfg.sample b/bin/packages/config.cfg.sample index c14477d3..2483e6c9 100644 --- a/bin/packages/config.cfg.sample +++ b/bin/packages/config.cfg.sample @@ -1,8 +1,8 @@ [Directories] -bloomfilters = /home/user/Blooms/ +bloomfilters = Blooms pastes = PASTES -wordtrending_csv = /home/user/AIL/var/www/static/csv/wordstrendingdata -wordsfile = /home/user/AIL/files/wordfile +wordtrending_csv = var/www/static/csv/wordstrendingdata +wordsfile = files/wordfile ##### Redis ##### [Redis_Cache] @@ -70,4 +70,4 @@ cc_critical = DE # Indexer configuration [Indexer] type = whoosh -path = /home/user/indexdir +path = indexdir