Add deployment and version for environment

This commit is contained in:
itay 2019-04-22 18:07:20 +03:00
parent e256ad3ee5
commit 614f464f24
3 changed files with 19 additions and 1 deletions

View File

@ -37,6 +37,21 @@ class Environment(object):
h.update(secret)
return h.hexdigest()
def get_deployment(self):
return self._get_from_config('deployment', 'unknown')
def is_develop(self):
return self.get_deployment() == 'develop'
def get_version(self):
return self._get_from_config('monkey_version', 'unknown') + ('-dev' if self.is_develop() else '')
def _get_from_config(self, key, default_value=None):
val = default_value
if self.config is not None:
val = self.config.get(key, val)
return val
@abc.abstractmethod
def get_auth_users(self):
return

View File

@ -32,6 +32,7 @@ def load_env_from_file():
config_json = load_server_configuration_from_file()
return config_json['server_config']
try:
config_json = load_server_configuration_from_file()
__env_type = config_json['server_config']

View File

@ -1,3 +1,5 @@
{
"server_config": "standard"
"server_config": "standard",
"deployment": "develop",
"monkey_version": "1.6.2"
}