moulinette/moulinette/globals.py
Luke Murphy e027a188a9
Refactor exposing of global configuration
We do this to make it easier to control this value during testing. We
should not import these values at package setup time. Nor should we
import them at package load time.

This change introduces a new API for the Moulinette package. The
moulinette.env accessor. This is a breaking change. However, I've
searched around and can't seem to find any usage that relies directly on
these properties being available.

I've tried to maintain API backwards compatibility in all cases
otherwise.
2019-07-28 22:04:07 +02:00

12 lines
451 B
Python

"""Moulinette global configuration core."""
from os import environ
def init_moulinette_env():
return {
'DATA_DIR': environ.get('MOULINETTE_DATA_DIR', '/usr/share/moulinette'),
'LIB_DIR': environ.get('MOULINETTE_LIB_DIR', '/usr/lib/moulinette'),
'LOCALES_DIR': environ.get('MOULINETTE_LOCALES_DIR', '/usr/share/moulinette/locale'),
'CACHE_DIR': environ.get('MOULINETTE_CACHE_DIR', '/var/cache/moulinette'),
}