From: Pieter Lexis Date: Fri, 1 Jul 2016 14:40:56 +0000 (+0200) Subject: rec_control: add reload-lua-config option X-Git-Tag: rec-4.0.0~16^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F4090%2Fhead;p=thirdparty%2Fpdns.git rec_control: add reload-lua-config option Closes #4085 --- diff --git a/docs/manpages/rec_control.1.md b/docs/manpages/rec_control.1.md index da0b383dc0..b31fef1db5 100644 --- a/docs/manpages/rec_control.1.md +++ b/docs/manpages/rec_control.1.md @@ -109,8 +109,15 @@ quit-nicely reload-acls : Reloads ACLs. -reload-lua-script *FILENAME* -: (Re)loads Lua script *FILENAME*. This replaces the script currently loaded. +reload-lua-script [*FILENAME*] +: (Re)loads Lua script *FILENAME*. If *FILENAME* is empty, attempt to reload + the currently loaded script. This replaces the script currently loaded. + +reload-lua-config [*FILENAME*] +: (Re)loads Lua configuration *FILENAME*. If *FILENAME* is empty, attempt to + reload the currently loaded file. Note that *FILENAME* will be fully executed, + any settings changed at runtime that are not modified in this file, will + still be active. reload-zones : Reload authoritative and forward zones. Retains current configuration diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index 3e0b7c40e2..296dded874 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -1103,6 +1103,7 @@ string RecursorControlParser::getAnswer(const string& question, RecursorControlP "quit-nicely stop the recursor daemon nicely\n" "reload-acls reload ACLS\n" "reload-lua-script [filename] (re)load Lua script\n" +"reload-lua-config [filename] (re)load Lua configuration file\n" "reload-zones reload all auth and forward zones\n" "set-minimum-ttl value set minimum-ttl-override\n" "set-carbon-server set a carbon server for telemetry\n" @@ -1154,6 +1155,23 @@ string RecursorControlParser::getAnswer(const string& question, RecursorControlP if(cmd=="reload-lua-script") return doQueueReloadLuaScript(begin, end); + if(cmd=="reload-lua-config") { + if(begin != end) + ::arg().set("lua-config-file") = *begin; + + try { + loadRecursorLuaConfig(::arg()["lua-config-file"]); + L<