forked from p15670423/monkey
Add deployment and version for environment
This commit is contained in:
parent
e256ad3ee5
commit
614f464f24
|
@ -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
|
||||
|
|
|
@ -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']
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{
|
||||
"server_config": "standard"
|
||||
"server_config": "standard",
|
||||
"deployment": "develop",
|
||||
"monkey_version": "1.6.2"
|
||||
}
|
Loading…
Reference in New Issue