This ensures we cannot start up if the file is unreadable.
Closes #4939
g_dnssecLogBogus = ::arg().mustDo("dnssec-log-bogus");
- loadRecursorLuaConfig(::arg()["lua-config-file"], ::arg().mustDo("daemon"));
+ try {
+ loadRecursorLuaConfig(::arg()["lua-config-file"], ::arg().mustDo("daemon"));
+ }
+ catch (PDNSException &e) {
+ L<<Logger::Error<<"Cannot load Lua configuration: "<<e.reason<<endl;
+ exit(1);
+ }
parseACLs();
sortPublicSuffixList();
if(fname.empty())
return;
ifstream ifs(fname);
- if(!ifs) {
- theL()<<"Unable to read configuration file from '"<<fname<<"': "<<strerror(errno)<<endl;
- return;
- }
+ if(!ifs)
+ throw PDNSException("Cannot open file '"+fname+"': "+strerror(errno));
+
Lua.writeFunction("clearSortlist", [&lci]() { lci.sortlist.clear(); });
/* we can get: "1.2.3.4"