changeset 3650:76ae40e514eb beta

config: automatically assign instance_id for host and process if it has been set to * It is no longer a problem to invent new instance_ids on startup - unused keys will be deleted.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 03 Apr 2013 15:56:12 +0200
parents 24e24661c0eb
children 659bd922520e
files rhodecode/config/environment.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/config/environment.py	Tue Apr 02 19:01:25 2013 +0200
+++ b/rhodecode/config/environment.py	Wed Apr 03 15:56:12 2013 +0200
@@ -101,6 +101,12 @@
     set_available_permissions(config)
     config['base_path'] = repos_path
     set_rhodecode_config(config)
+
+    instance_id = rhodecode.CONFIG.get('instance_id')
+    if instance_id == '*':
+        instance_id = '%s-%s' % (os.uname()[1], os.getpid())
+        rhodecode.CONFIG['instance_id'] = instance_id
+
     # CONFIGURATION OPTIONS HERE (note: all config options will override
     # any Pylons config options)