"""Generate C++ code to declare old-style settings"""
file.write("void pdns::settings::rec::defineOldStyleSettings()\n{\n")
for entry in entries:
+ if "skip-old" in entry:
+ continue
helptxt = quote(entry["help"])
oldname = quote(entry["oldname"])
if entry["type"] == LType.Bool:
return getStatByName(name);
}
-static void apiWriteConfigFile(const string& filebasename, const string& content)
+static void checkApiDirSet()
{
if (::arg()["api-config-dir"].empty()) {
+ if (g_yamlSettings) {
+ throw ApiException("Config option webservice.api_dir must be set");
+ }
throw ApiException("Config Option \"api-config-dir\" must be set");
}
+}
+
+static void apiWriteConfigFile(const string& filebasename, const string& content)
+{
+ checkApiDirSet();
string filename = ::arg()["api-config-dir"] + "/" + filebasename;
if (g_yamlSettings) {
static void doCreateZone(const Json& document)
{
- if (::arg()["api-config-dir"].empty()) {
- throw ApiException("Config Option \"api-config-dir\" must be set");
- }
+ checkApiDirSet();
const DNSName zone = apiNameToDNSName(stringFromJson(document, "name"));
const string zonename = zone.toString();
static bool doDeleteZone(const DNSName& zonename)
{
- if (::arg()["api-config-dir"].empty()) {
- throw ApiException("Config Option \"api-config-dir\" must be set");
- }
+ checkApiDirSet();
string filename;
if (g_yamlSettings) {
static void apiServerZonesPOST(HttpRequest* req, HttpResponse* resp)
{
- if (::arg()["api-config-dir"].empty()) {
- throw ApiException("Config Option \"api-config-dir\" must be set");
- }
+ checkApiDirSet();
Json document = req->json();