diff options
Diffstat (limited to 'talerbank/talerconfig.py')
-rw-r--r-- | talerbank/talerconfig.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/talerbank/talerconfig.py b/talerbank/talerconfig.py index e8dd384..74d6aff 100644 --- a/talerbank/talerconfig.py +++ b/talerbank/talerconfig.py @@ -1,3 +1,26 @@ +# This file is part of TALER +# (C) 2016 INRIA +# +# TALER is free software; you can redistribute it and/or modify it under the +# terms of the GNU Affero General Public License as published by the Free Software +# Foundation; either version 3, or (at your option) any later version. +# +# TALER is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> +# +# @author Florian Dold + +""" +Parse GNUnet-style configurations in pure Python +""" + +# FIXME: make sure that autovivification of config entries +# does not leave garbage behind (use weakrefs!) + import logging import collections import os @@ -111,6 +134,14 @@ class TalerConfig: return logger.warn("no base directory found") + def load_env(self, dirname, *args, **kwargs): + """ + Load file from environment variable TALER_CONFIG_FILE + or from default location if the variable is not set. + """ + filename = os.environ.get("TALER_CONFIG_FILE") + self.load_file(filename, *args, **kwargs) + def load_dir(self, dirname): try: files = os.listdir(dirname) |