DIR *dirp;
struct dirent *ent;
+ std::list<std::string> files;
if (!(dirp = opendir(dirname.c_str()))) {
errlog("Error opening the included directory %s!", dirname.c_str());
g_outputBuffer="Error opening the included directory " + dirname + "!";
continue;
}
- std::ifstream ifs(namebuf.str());
- if (!ifs) {
- warnlog("Unable to read configuration from '%s'", namebuf.str());
- } else {
- vinfolog("Read configuration from '%s'", namebuf.str());
- }
-
- g_lua.executeCode(ifs);
+ files.push_back(namebuf.str());
}
}
+
closedir(dirp);
+ files.sort();
+
+ for (auto file = files.begin(); file != files.end(); ++file) {
+ std::ifstream ifs(*file);
+ if (!ifs) {
+ warnlog("Unable to read configuration from '%s'", *file);
+ } else {
+ vinfolog("Read configuration from '%s'", *file);
+ }
+
+ g_lua.executeCode(ifs);
+ }
g_included = false;
});
_config_template = """
-- this directory contains a file allowing includedir.advanced.tests.powerdns.com.
includeDirectory('test-include-dir')
- addAction(AllRule(), RCodeAction(dnsdist.REFUSED))
newServer{address="127.0.0.1:%s"}
"""