Skip to content
Snippets Groups Projects
Commit 42446e3d authored by Ferenc Schulcz's avatar Ferenc Schulcz
Browse files

Configurable knot location

parent f890c210
No related branches found
No related tags found
No related merge requests found
{ {
"higherLevelDomain": "dyndns.mydomain.com", "higherLevelDomain": "dyndns.mydomain.com",
"knotLocation": "/usr/sbin/knotc",
"dbHost": "localhost", "dbHost": "localhost",
"listenAddress": "127.0.0.1", "listenAddress": "127.0.0.1",
"listenPort": 3000 "listenPort": 3000
......
...@@ -5,17 +5,17 @@ const config = require('./config'); ...@@ -5,17 +5,17 @@ const config = require('./config');
async function updateRecord(domain, ip) { async function updateRecord(domain, ip) {
try { try {
await exec("/usr/sbin/knotc zone-begin " + config.config().higherLevelDomain); await exec(config.config().knotLocation + " zone-begin " + config.config().higherLevelDomain);
try { try {
await exec("/usr/sbin/knotc zone-unset " + config.config().higherLevelDomain + " " + domain); await exec(config.config().knotLocation + " zone-unset " + config.config().higherLevelDomain + " " + domain);
} catch { } catch {
console.log("Could not unset domain " + domain); console.log("Could not unset domain " + domain);
} }
await exec("/usr/sbin/knotc zone-set " + config.config().higherLevelDomain + " " + domain + " 60 A " + ip); await exec(config.config().knotLocation + " 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-commit " + config.config().higherLevelDomain);
} catch { } catch {
try { 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."); console.log("Problem with manipulating DNS zone " + config.config().higherLevelDomain + ". Aborted transaction.");
} catch { } catch {
console.log("Problem with manipulating DNS zone " + config.config().higherLevelDomain + ". Could not even abort transaction."); console.log("Problem with manipulating DNS zone " + config.config().higherLevelDomain + ". Could not even abort transaction.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment