diff --git a/config.json.defaults b/config.json.defaults index 657c72bcab912fa5c92e2b3e24ab385813c5eee8..802a07778174fd2cd08c329d23d1db2eba4cae31 100644 --- a/config.json.defaults +++ b/config.json.defaults @@ -1,5 +1,6 @@ { "higherLevelDomain": "dyndns.mydomain.com", + "knotLocation": "/usr/sbin/knotc", "dbHost": "localhost", "listenAddress": "127.0.0.1", "listenPort": 3000 diff --git a/knotdns.js b/knotdns.js index b50f8627819fb21d08d959ac4ede448a1db37358..5dd9d3160f73ede90c4a54409a85be828754c663 100644 --- a/knotdns.js +++ b/knotdns.js @@ -5,17 +5,17 @@ const config = require('./config'); async function updateRecord(domain, ip) { try { - await exec("/usr/sbin/knotc zone-begin " + config.config().higherLevelDomain); + await exec(config.config().knotLocation + " zone-begin " + config.config().higherLevelDomain); try { - await exec("/usr/sbin/knotc zone-unset " + config.config().higherLevelDomain + " " + domain); + await exec(config.config().knotLocation + " zone-unset " + config.config().higherLevelDomain + " " + domain); } catch { console.log("Could not unset domain " + domain); } - await exec("/usr/sbin/knotc zone-set " + config.config().higherLevelDomain + " " + domain + " 60 A " + ip); - await exec("/usr/sbin/knotc zone-commit " + config.config().higherLevelDomain); + await exec(config.config().knotLocation + " zone-set " + config.config().higherLevelDomain + " " + domain + " 60 A " + ip); + await exec(config.config().knotLocation + " zone-commit " + config.config().higherLevelDomain); } catch { try { - await exec("/usr/sbin/knotc zone-abort " + config.config().higherLevelDomain); + await exec(config.config().knotLocation + " zone-abort " + config.config().higherLevelDomain); console.log("Problem with manipulating DNS zone " + config.config().higherLevelDomain + ". Aborted transaction."); } catch { console.log("Problem with manipulating DNS zone " + config.config().higherLevelDomain + ". Could not even abort transaction.");