Update
ci/woodpecker/push/woodpecker Pipeline was successful
Podrobnosti
ci/woodpecker/push/woodpecker Pipeline was successful
Podrobnosti
This commit is contained in:
rodič
ef872a2a51
revize
95696c0b94
|
@ -2,6 +2,20 @@
|
|||
|
||||
const Hapi = require('@hapi/hapi');
|
||||
const fs = require('fs')
|
||||
const { execSync } = require('child_process')
|
||||
|
||||
let spec = 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' }})
|
||||
console.log(out.toString())
|
||||
|
||||
console.log('Spec builded. Done.')
|
||||
spec = JSON.parse(fs.readFileSync('../build/spec.json'))
|
||||
}
|
||||
|
||||
const init = async () => {
|
||||
|
||||
|
@ -14,13 +28,18 @@ const init = async () => {
|
|||
method: 'GET',
|
||||
path: '/api/spec',
|
||||
handler: (request, h) => {
|
||||
const spec = JSON.parse(fs.readFileSync('../build/spec.json'))
|
||||
return spec
|
||||
}
|
||||
});
|
||||
|
||||
await server.start();
|
||||
console.log('Server running on %s', server.info.uri);
|
||||
|
||||
setTimeout(async () => {
|
||||
await buildSpec()
|
||||
}, 1000 * 60 * 15)
|
||||
|
||||
await buildSpec()
|
||||
};
|
||||
|
||||
process.on('unhandledRejection', (err) => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "gweicz-services",
|
||||
"module": "index.ts",
|
||||
"scripts": {
|
||||
"build": "node ./scripts/build-data.js"
|
||||
"build": "node ./scripts/build.js"
|
||||
},
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
import build from './lib.js'
|
||||
|
||||
build()
|
|
@ -3,6 +3,8 @@ import fs from 'fs'
|
|||
import jsonata from 'jsonata'
|
||||
import fetch from 'node-fetch'
|
||||
|
||||
const SOURCE_FILE = process.env.GWEICZ_SYSINFO_SPEC || './spec/services.yaml'
|
||||
|
||||
const outputFn = 'build/spec.json'
|
||||
|
||||
const strategies = {
|
||||
|
@ -29,8 +31,10 @@ async function getVersions (config, all) {
|
|||
return { local, latest }
|
||||
}
|
||||
|
||||
async function build () {
|
||||
const spec = yaml.load(fs.readFileSync('./spec/services.yaml'))
|
||||
export default async function build (src = SOURCE_FILE) {
|
||||
console.log(`Source: ${src}`)
|
||||
|
||||
const spec = yaml.load(fs.readFileSync(src))
|
||||
|
||||
for (const item of spec.services) {
|
||||
|
||||
|
@ -46,6 +50,6 @@ async function build () {
|
|||
fs.writeFileSync(outputFn, JSON.stringify(spec, null, 2))
|
||||
console.log(`saved: ${outputFn}`)
|
||||
console.log('build done')
|
||||
}
|
||||
|
||||
build()
|
||||
return spec
|
||||
}
|
binární
web/static/favicon.png
binární
web/static/favicon.png
Binární soubor nebyl zobrazen.
Před Šířka: | Výška: | Velikost: 1.5 KiB Za Šířka: | Výška: | Velikost: 1.3 KiB |
Načítá se…
Odkázat v novém úkolu