X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_mon%2Fcore%2Fsettings.py;h=a5be2d17811a2f9c8b07547254a0cff4ea434295;hb=refs%2Fchanges%2F29%2F6929%2F4;hp=ae717e03ed52a4465a13d1b32a14a6927065b651;hpb=b85fc8cdf840080b10d01c33b4a57a2a39bcc0f1;p=osm%2FMON.git diff --git a/osm_mon/core/settings.py b/osm_mon/core/settings.py index ae717e0..a5be2d1 100644 --- a/osm_mon/core/settings.py +++ b/osm_mon/core/settings.py @@ -26,7 +26,7 @@ import os from collections import namedtuple -from osm_mon.plugins.OpenStack.singleton import Singleton +from osm_mon.core.singleton import Singleton import six @@ -60,9 +60,20 @@ class Config(object): _configuration = [ CfgParam('BROKER_URI', "localhost:9092", six.text_type), + CfgParam('MONGO_URI', "mongodb://mongo:27017", six.text_type), 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('OS_DEFAULT_GRANULARITY', 300, int), + CfgParam('REQUEST_TIMEOUT', 10, int), + CfgParam('OSMMON_LOG_LEVEL', "INFO", six.text_type), + CfgParam('OSMMON_KAFKA_LOG_LEVEL', "WARN", six.text_type), + CfgParam('OSMMON_COLLECTOR_INTERVAL', 30, int), + CfgParam('OSMMON_EVALUATOR_INTERVAL', 30, int), + CfgParam('OSMMON_VCA_HOST', "localhost", six.text_type), + CfgParam('OSMMON_VCA_SECRET', "secret", six.text_type), + CfgParam('OSMMON_VCA_USER', "admin", six.text_type), + CfgParam('OSMMON_DATABASE_COMMONKEY', "changeme", six.text_type), + CfgParam('OSMMON_PROMETHEUS_URL', "http://prometheus:9090", six.text_type), ] _config_dict = {cfg.key: cfg for cfg in _configuration} @@ -72,13 +83,14 @@ 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.warning("Environment variable not present: %s", exc) + log.debug("Environment variable not present: %s", exc) return