added .drone.yml
This commit is contained in:
parent
3a4b543754
commit
a2677ef2a3
2 changed files with 17 additions and 3 deletions
12
.drone.yml
Normal file
12
.drone.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: docker
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: samuelph/cachet-monitor
|
||||
username:
|
||||
from_secret: USERNAME
|
||||
password:
|
||||
from_secret: PASSWORD
|
8
index.js
8
index.js
|
@ -1,16 +1,18 @@
|
|||
const config = require('./data/config');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const cron = require('node-cron');
|
||||
const fetch = require('node-fetch');
|
||||
const abort = require('abort-controller');
|
||||
const nmap = require('libnmap');
|
||||
|
||||
const cache = fs.existsSync("data/cache.json") ? JSON.parse(fs.readFileSync("data/cache.json", {encoding: "utf8"})) : {};
|
||||
let cachePath = path.resolve("./data/cache.json");
|
||||
const cache = fs.existsSync(cachePath) ? JSON.parse(fs.readFileSync(cachePath, {encoding: "utf8"})) : {};
|
||||
// delete cache file to remove orphaned cache values
|
||||
fs.unlinkSync("data/cache.json");
|
||||
fs.unlinkSync(cachePath);
|
||||
|
||||
process.on('SIGINT', () => {
|
||||
fs.writeFileSync("data/cache.json", JSON.stringify(cache), {encoding: "utf8"});
|
||||
fs.writeFileSync(cachePath, JSON.stringify(cache), {encoding: "utf8"});
|
||||
process.exit(0);
|
||||
});
|
||||
|
||||
|
|
Reference in a new issue