expose variables to environnement

This commit is contained in:
Benjamin Bohard 2020-03-12 16:08:16 +01:00
parent cc6dd3efe3
commit 8bec9c7ce1
2 changed files with 6 additions and 4 deletions

View File

@ -4,10 +4,12 @@ from os import environ
CONFIGURATION_DIR = 'configurations'
TMP_DIR = 'tmp'
DEFAULT_USER = environ.get('DEFAULT_USER', 'Anonymous')
DEFAULT_DSN = environ.get('RISOTTO_DSN', 'postgres:///risotto?host=/var/run/postgresql/&user=risotto')
DEFAULT_DSN = environ.get('DEFAULT_DSN', 'postgres:///risotto?host=/var/run/postgresql/&user=risotto')
DEFAULT_TIRAMISU_DSN = environ.get('DEFAULT_TIRAMISU_DSN', 'postgres:///tiramisu?host=/var/run/postgresql/&user=tiramisu')
MESSAGE_PATH = environ.get('MESSAGE_PATH', '/root/risotto-message/messages')
SQL_DIR = environ.get('SQL_DIR', './sql')
CACHE_ROOT_PATH = environ.get('CACHE_ROOT_PATH', '/var/cache/risotto')
SRV_SEED_PATH = environ.get('SRV_SEED_PATH', '/srv/seed')
def get_config():
@ -22,8 +24,8 @@ def get_config():
'check_role': True,
'admin_user': DEFAULT_USER,
'sql_dir': SQL_DIR},
'source': {'root_path': '/srv/seed'},
'cache': {'root_path': '/var/cache/risotto'},
'source': {'root_path': SRV_SEED_PATH},
'cache': {'root_path': CACHE_ROOT_PATH},
'servermodel': {'internal_source': 'internal',
'internal_distribution': 'last',
'internal_release_name': 'none'},

View File

@ -201,7 +201,7 @@ class RegisterDispatcher:
else:
missing_messages.append(message)
if missing_messages:
raise RegistrationError(_(f'missing uri {missing_messages}'))
raise RegistrationError(_(f'no matching function for uri {missing_messages}'))
async def on_join(self):
internal_user = get_config()['global']['internal_user']