Update server
ci/woodpecker/push/woodpecker Pipeline was successful Podrobnosti

This commit is contained in:
tree 2022-10-21 14:06:19 +02:00
rodič d6284f8172
revize a9990acca6
1 změnil soubory, kde provedl 18 přidání a 2 odebrání

Zobrazit soubor

@ -4,19 +4,31 @@ const Hapi = require('@hapi/hapi');
const fs = require('fs')
const { execSync } = require('child_process')
const dir = '/corn/sftpgo/data/data/gweicz-sysinfo'
const SPEC_FILE = `${dir}/spec/services.yaml`
let spec = null
let mtime = null
async function buildSpec () {
console.log('Building spec ..')
const dir = '/corn/sftpgo/data/data/gweicz-sysinfo'
const out = execSync('cd .. && npm run build', { env: { GWEICZ_SYSINFO_SPEC: '/corn/sftpgo/data/data/gweicz-sysinfo/spec/services.yaml' }})
const out = execSync('cd .. && npm run build', { env: { GWEICZ_SYSINFO_SPEC: SPEC_FILE }})
console.log(out.toString())
console.log('Spec builded. Done.')
mtime = new Date()
spec = JSON.parse(fs.readFileSync('../build/spec.json'))
}
async function checkLoaded () {
const specStat = fs.statSync(SPEC_FILE)
if (new Date(specStat.mtime) > mtime) {
console.log('Found new version, rebuilding ..')
await buildSpec()
}
}
const init = async () => {
const server = Hapi.server({
@ -39,6 +51,10 @@ const init = async () => {
await buildSpec()
}, 1000 * 60 * 15)
setTimeout(async () => {
await checkLoaded()
}, 1000 * 60)
await buildSpec()
};