From b5ddefdaac7e07c8d42bf541287b8335584c62b2 Mon Sep 17 00:00:00 2001 From: Benjamin Bohard Date: Fri, 20 Dec 2019 10:15:38 +0100 Subject: [PATCH] Compute messages root path against project root dir in development environment --- src/risotto/config.py | 10 +++++++--- src/risotto/message/message.py | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/risotto/config.py b/src/risotto/config.py index 36ef8b2..6061aa2 100644 --- a/src/risotto/config.py +++ b/src/risotto/config.py @@ -10,6 +10,10 @@ ROUGAIL_DTD_PATH = '../rougail/data/creole.dtd' POSTGRESQL_ADDRESS = '192.168.56.106' POSTGRESQL_PORT = 5432 +import os +from pathlib import PurePosixPath +CURRENT_PATH = PurePosixPath(__file__) + def get_config(): return {'database': {'host': 'localhost', 'port': 5432, @@ -18,10 +22,10 @@ def get_config(): 'password': 'risotto', }, 'http_server': {'port': 8080}, - 'global': {'message_root_path': 'messages', + 'global': {'message_root_path': CURRENT_PATH.parents[2] / 'messages', 'debug': DEBUG, 'internal_user': 'internal', 'rougail_dtd_path': '../rougail/data/creole.dtd'}, - 'source': {'root_path': '/srv/seed'}, - 'cache': {'root_path': '/var/cache/risotto'} + 'source': {'root_path': '/home/bbohard/Cadoles/tmp/srv/seed'}, + 'cache': {'root_path': '/home/bbohard/Cadoles/tmp/var/cache/risotto'} } diff --git a/src/risotto/message/message.py b/src/risotto/message/message.py index 784d78e..20b8d3b 100644 --- a/src/risotto/message/message.py +++ b/src/risotto/message/message.py @@ -9,9 +9,10 @@ from tiramisu import StrOption, IntOption, BoolOption, ChoiceOption, OptionDescr from yaml import load, SafeLoader from os import listdir from os.path import isfile -from ..config import MESSAGE_ROOT_PATH +from ..config import get_config from ..utils import _ +MESSAGE_ROOT_PATH = get_config().get('global').get('message_root_path') groups.addgroup('message')