chiark / gitweb /
hippotatd: support --print-config
[hippotat.git] / hippotatd
index e3e42fb18ee6790dfc8125206a720970c2316099..a235929d8c1c2b1b4e0c7d100a2b3f05acfe480b 100755 (executable)
--- a/hippotatd
+++ b/hippotatd
@@ -326,6 +326,12 @@ def process_cfg(_opts, putative_servers, putative_clients):
                     ('peer', 'vrelay'),
                     ('rnets','vnetwork')))
 
+  if opts.printconfig is not None:
+    try: val = cfg.get(c.server, opts.printconfig)
+    except NoOptionError: pass
+    else: print(val)
+    sys.exit(0)
+
 def catch_termination():
   def run_cleanups():
     for cleanup in cleanups:
@@ -446,6 +452,12 @@ optparser.add_option('--syslog-facility',
                      default=None,
                      help='log to syslog, with specified facility')
 
+optparser.add_option('--print-config',
+                     nargs=1, type='string',action='store',
+                     metavar='OPTION', dest='printconfig',
+                     default=None,
+                     help='print one config option value and exit')
+
 common_startup(process_cfg)
 catch_termination()
 start_http()