Skip to content

Commit

Permalink
Merge pull request #71 from dappnode/v0.1.15
Browse files Browse the repository at this point in the history
V0.1.14
  • Loading branch information
eduadiez authored Oct 17, 2018
2 parents 3811f70 + e78b598 commit 2afe424
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions build/src/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,18 @@ async function start() {

// Watch for IP changes, if so update the IP. On error, asume the IP changed.
let _ip = '';
setInterval(() => {
if (!db.get('staticIp').value()) {
dyndnsClient.getPublicIp().then((ip) => {
setInterval(async () => {
try {
if (!db.get('staticIp').value()) {
const ip = await dyndnsClient.getPublicIp();
if (!ip || ip !== _ip) {
dyndnsClient.updateIp();
_ip = ip;
}
if (ip) db.set('ip', ip).write();
});
}
} catch (e) {
logs.error(`Error on dyndns interval: ${e.stack || e.message}`);
}
}, publicIpCheckInterval);

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions build/src/src/dyndnsClient/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const updateIp = require('./updateIp');
const getKeys = require('./getKeys');
const checkPublicIp = require('./checkPublicIp');
const getPublicIp = require('./getPublicIp');

module.exports = {
updateIp,
getKeys,
checkPublicIp,
getPublicIp,
};

0 comments on commit 2afe424

Please sign in to comment.