From 6566fdfb40eeacd7be792ee592f3594f5ec533e5 Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Fri, 1 Jul 2016 16:40:56 +0200 Subject: [PATCH] rec_control: add reload-lua-config option Closes #4085 --- docs/manpages/rec_control.1.md | 11 +++++++++-- pdns/rec_channel_rec.cc | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/docs/manpages/rec_control.1.md b/docs/manpages/rec_control.1.md index da0b383dc..b31fef1db 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 3e0b7c40e..296dded87 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<