Skip to content
Browse files

Added automatic ident discovery

  • Loading branch information...
1 parent 399a228 commit 0de7dc7532227cb7231dbb2c7ba4d302c682a148 @jbohman committed Aug 18, 2010
Showing with 7 additions and 3 deletions.
  1. +1 −1 logsandra.yaml
  2. +6 −2 logsandra/utils/config.py
View
2 logsandra.yaml
@@ -1,5 +1,5 @@
# Ident
-ident: 'Logsandra Server 1'
+#ident: 'Logsandra Server 1'
# Web service
httpd_host: '0.0.0.0'
View
8 logsandra/utils/config.py
@@ -5,8 +5,12 @@ def parse(config_file):
config = yaml.load(file_handler.read())
if 'ident' not in config:
- raise Exception('Config %s must contain an ident' % config_file)
-
+ import socket
+ ident = socket.gethostname()
+ if not ident:
+ raise Exception('Config %s must contain an ident' % config_file)
+ else:
+ config['ident'] = ident
if 'httpd_address' not in config:
config['httpd_address'] = '0.0.0.0'

0 comments on commit 0de7dc7

Please sign in to comment.
Something went wrong with that request. Please try again.