feat: add environemnt variable to run grab at startup on docker

This commit is contained in:
Aandree5
2025-08-11 11:26:39 +01:00
parent 9f407f3b8a
commit b18bcd9106
3 changed files with 33 additions and 20 deletions

View File

@@ -1,24 +1,35 @@
const grab = process.env.SITE
? `npm run grab -- --site=${process.env.SITE} ${
process.env.CLANG ? `--lang=${process.env.CLANG}` : ''
} --output=public/guide.xml`
? `npm run grab -- --site=${process.env.SITE} ${process.env.CLANG ? `--lang=${process.env.CLANG}` : ''
} --output=public/guide.xml`
: 'npm run grab -- --channels=channels.xml --output=public/guide.xml'
module.exports = {
apps: [
{
name: 'serve',
script: 'npx serve -- public',
instances: 1,
watch: false,
autorestart: true
},
{
name: 'grab',
script: `npx chronos -e "${grab}" -p "${process.env.CRON_SCHEDULE}" -l`,
instances: 1,
watch: false,
autorestart: true
}
]
const apps = [
{
name: 'serve',
script: 'npx serve -- public',
instances: 1,
watch: false,
autorestart: true
},
{
name: 'grab',
script: `npx chronos -e "${grab}" -p "${process.env.CRON_SCHEDULE}" -l`,
instances: 1,
watch: false,
autorestart: true
}
];
if (process.env.RUN_AT_STARTUP === 'true') {
apps.push({
name: 'grab-at-startup',
script: grab,
instances: 1,
autorestart: false,
watch: false,
max_restarts: 1
});
}
module.exports = { apps };