X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_mon%2Fcore%2Fsettings.py;h=d27f0ca70c534deec1e3906e49dc837c131afca3;hb=3dd2f6e81fd4997d0d1bb655534677e464072215;hp=db78b4a21bc331778dbba991ea3da02a4c632fba;hpb=b726161f9fe605ceb418d9b5df12d295bff28c3a;p=osm%2FMON.git diff --git a/osm_mon/core/settings.py b/osm_mon/core/settings.py index db78b4a..d27f0ca 100644 --- a/osm_mon/core/settings.py +++ b/osm_mon/core/settings.py @@ -64,6 +64,7 @@ class Config(object): CfgParam('DATABASE', "sqlite:///mon_sqlite.db", six.text_type), CfgParam('OS_NOTIFIER_URI', "http://localhost:8662", six.text_type), CfgParam('OS_DEFAULT_GRANULARITY', "300", six.text_type), + CfgParam('REQUEST_TIMEOUT', 10, int), ] _config_dict = {cfg.key: cfg for cfg in _configuration} @@ -73,12 +74,13 @@ class Config(object): """Set the default values.""" for cfg in self._configuration: setattr(self, cfg.key, cfg.default) + self.read_environ() def read_environ(self): """Check the appropriate environment variables and update defaults.""" for key in self._config_keys: try: - val = str(os.environ[key]) + val = self._config_dict[key].data_type(os.environ[key]) setattr(self, key, val) except KeyError as exc: log.debug("Environment variable not present: %s", exc)