From 2f5826fafb0956c754133f7f3005de3f87f37cfa Mon Sep 17 00:00:00 2001 From: Tony Hsu Date: Sat, 10 Aug 2024 00:41:51 +0200 Subject: [PATCH] Add `daemon` option --- bin/catadog | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/catadog b/bin/catadog index 2b4d2b6..42ffa9d 100755 --- a/bin/catadog +++ b/bin/catadog @@ -348,7 +348,8 @@ module Datadog Logger: logger, AccessLog: [[logger.instance_variable_get(:@logdev).dev, WEBrick::AccessLog::COMBINED_LOG_FORMAT]], BindAddress: settings.host.to_s, - Port: settings.port + Port: settings.port, + ServerType: settings.daemon ? WEBrick::Daemon : WEBrick::SimpleServer # RequestCallback: request_callback } end @@ -366,7 +367,8 @@ module Datadog :record_dir, :silent, :log, - :mocks + :mocks, + :daemon def initialize @debug = false @@ -378,6 +380,7 @@ module Datadog @agent_port = 8126 @record_dir = nil @silent = false + @daemon = false @log = $stderr @mocks = [] end @@ -402,6 +405,8 @@ module Datadog case arg when "-d", "--debug" settings.debug = true + when "--daemon" + settings.daemon = true when "-s", "--silent" settings.silent = true when "-v", "--verbose"