Skip to content

Commit

Permalink
Merge pull request #80 from dappnode/dev
Browse files Browse the repository at this point in the history
Some fixes
  • Loading branch information
eduadiez authored Oct 20, 2018
2 parents 7ea09e2 + 78bde40 commit ffafc7e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
18 changes: 12 additions & 6 deletions build/src/src/calls/getParams.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
const db = require('../db');

async function getParams() {
const result = {
ip: db.get('ip').value(),
name: db.get('name').value(),
};
const staticIp = db.get('staticIp').value();
const domain = db.get('domain').value();
if (staticIp) {
result.staticIp = staticIp;
} else {
result.domain = domain;
}
return {
result: {
ip: db.get('ip').value(),
name: db.get('name').value(),
staticIp: db.get('staticIp').value(),
domain: db.get('domain').value(),
},
result,
};
}

Expand Down
2 changes: 1 addition & 1 deletion build/src/src/calls/setStaticIp.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function setStaticIp({staticIp}) {
} else if (oldStaticIp && !staticIp) {
message = `Disabled static IP`;
// If the staticIp is being disabled but there is no keypair: register to dyndns
if (!db.get('keypair').value()) {
if (!db.get('registeredToDyndns').value()) {
await dyndnsClient.updateIp();
message += `, and registered to dyndns: ${db.get('domain').value()}`;
}
Expand Down
1 change: 1 addition & 0 deletions build/src/src/dyndnsClient/updateIp.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ function updateIp() {
})
.then((domain) => {
db.set('domain', domain).write();
db.set('registeredToDyndns', true).write();
})
.catch((err) => {
logs.error(`httpGetRequest error: ${err.stack || err.message}`);
Expand Down

0 comments on commit ffafc7e

Please sign in to comment.