diff --git a/src/etos_lib/etos.py b/src/etos_lib/etos.py index e7a6fa9..0508874 100644 --- a/src/etos_lib/etos.py +++ b/src/etos_lib/etos.py @@ -1,4 +1,4 @@ -# Copyright 2020 Axis Communications AB. +# Copyright 2020-2021 Axis Communications AB. # # For a full list of individual contributors, please see the commit history. # @@ -23,6 +23,7 @@ from .lib.utils import Utils from .lib.http import Http from .lib.debug import Debug +from .lib.feature_flags import FeatureFlags from .lib.database import Database from .lib.secrets import Secrets from .lib.exceptions import ( @@ -46,6 +47,7 @@ class ETOS: # pylint: disable=too-many-instance-attributes __graphql = None __http = None __debug = None + __feature_flags = None __secrets = None __database = None @@ -89,6 +91,13 @@ def debug(self): self.__debug = Debug() return self.__debug + @property + def feature_flags(self): + """Entry for feature flags for ETOS.""" + if self.__feature_flags is None: + self.__feature_flags = FeatureFlags() + return self.__feature_flags + @property def monitor(self): """Entry for ETOS Library monitor service.""" diff --git a/src/etos_lib/lib/feature_flags.py b/src/etos_lib/lib/feature_flags.py new file mode 100644 index 0000000..b326152 --- /dev/null +++ b/src/etos_lib/lib/feature_flags.py @@ -0,0 +1,25 @@ +# Copyright 2021 Axis Communications AB. +# +# For a full list of individual contributors, please see the commit history. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""ETOS feature flags.""" +import os + +class FeatureFlags: + """Feature flags for ETOS.""" + + @property + def clm(self): + """Whether or not CLM sending shall be enabled.""" + return os.getenv("ETOS_FEATURE_CLM", "true") == "true" \ No newline at end of file