Compute messages root path against project root dir in development environment

This commit is contained in:
Benjamin Bohard 2019-12-20 10:15:38 +01:00
parent ddd97fb59c
commit b5ddefdaac
2 changed files with 9 additions and 4 deletions

View File

@ -10,6 +10,10 @@ ROUGAIL_DTD_PATH = '../rougail/data/creole.dtd'
POSTGRESQL_ADDRESS = '192.168.56.106' POSTGRESQL_ADDRESS = '192.168.56.106'
POSTGRESQL_PORT = 5432 POSTGRESQL_PORT = 5432
import os
from pathlib import PurePosixPath
CURRENT_PATH = PurePosixPath(__file__)
def get_config(): def get_config():
return {'database': {'host': 'localhost', return {'database': {'host': 'localhost',
'port': 5432, 'port': 5432,
@ -18,10 +22,10 @@ def get_config():
'password': 'risotto', 'password': 'risotto',
}, },
'http_server': {'port': 8080}, 'http_server': {'port': 8080},
'global': {'message_root_path': 'messages', 'global': {'message_root_path': CURRENT_PATH.parents[2] / 'messages',
'debug': DEBUG, 'debug': DEBUG,
'internal_user': 'internal', 'internal_user': 'internal',
'rougail_dtd_path': '../rougail/data/creole.dtd'}, 'rougail_dtd_path': '../rougail/data/creole.dtd'},
'source': {'root_path': '/srv/seed'}, 'source': {'root_path': '/home/bbohard/Cadoles/tmp/srv/seed'},
'cache': {'root_path': '/var/cache/risotto'} 'cache': {'root_path': '/home/bbohard/Cadoles/tmp/var/cache/risotto'}
} }

View File

@ -9,9 +9,10 @@ from tiramisu import StrOption, IntOption, BoolOption, ChoiceOption, OptionDescr
from yaml import load, SafeLoader from yaml import load, SafeLoader
from os import listdir from os import listdir
from os.path import isfile from os.path import isfile
from ..config import MESSAGE_ROOT_PATH from ..config import get_config
from ..utils import _ from ..utils import _
MESSAGE_ROOT_PATH = get_config().get('global').get('message_root_path')
groups.addgroup('message') groups.addgroup('message')