mirror of
https://github.com/iptv-org/epg
synced 2025-12-15 09:56:42 -05:00
feat: add environemnt variable to run grab at startup on docker
This commit is contained in:
@@ -6,6 +6,7 @@ ENV CRON_SCHEDULE="0 0 * * *"
|
|||||||
ENV GZIP=false
|
ENV GZIP=false
|
||||||
ENV MAX_CONNECTIONS=1
|
ENV MAX_CONNECTIONS=1
|
||||||
ENV DAYS=
|
ENV DAYS=
|
||||||
|
ENV RUN_AT_STARTUP=true
|
||||||
RUN apk update \
|
RUN apk update \
|
||||||
&& apk upgrade --available \
|
&& apk upgrade --available \
|
||||||
&& apk add curl git tzdata bash \
|
&& apk add curl git tzdata bash \
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ iptv-org/epg
|
|||||||
| DAYS | Number of days for which the guide will be loaded (defaults to the value from the site config) |
|
| DAYS | Number of days for which the guide will be loaded (defaults to the value from the site config) |
|
||||||
| TIMEOUT | Timeout for each request in milliseconds (default: 0) |
|
| TIMEOUT | Timeout for each request in milliseconds (default: 0) |
|
||||||
| DELAY | Delay between request in milliseconds (default: 0) |
|
| DELAY | Delay between request in milliseconds (default: 0) |
|
||||||
|
| RUN_AT_STARTUP | Run grab on container startup (default: true) |
|
||||||
|
|
||||||
## Database
|
## Database
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,35 @@
|
|||||||
const grab = process.env.SITE
|
const grab = process.env.SITE
|
||||||
? `npm run grab -- --site=${process.env.SITE} ${
|
? `npm run grab -- --site=${process.env.SITE} ${process.env.CLANG ? `--lang=${process.env.CLANG}` : ''
|
||||||
process.env.CLANG ? `--lang=${process.env.CLANG}` : ''
|
} --output=public/guide.xml`
|
||||||
} --output=public/guide.xml`
|
|
||||||
: 'npm run grab -- --channels=channels.xml --output=public/guide.xml'
|
: 'npm run grab -- --channels=channels.xml --output=public/guide.xml'
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
apps: [
|
const apps = [
|
||||||
{
|
{
|
||||||
name: 'serve',
|
name: 'serve',
|
||||||
script: 'npx serve -- public',
|
script: 'npx serve -- public',
|
||||||
instances: 1,
|
instances: 1,
|
||||||
watch: false,
|
watch: false,
|
||||||
autorestart: true
|
autorestart: true
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'grab',
|
name: 'grab',
|
||||||
script: `npx chronos -e "${grab}" -p "${process.env.CRON_SCHEDULE}" -l`,
|
script: `npx chronos -e "${grab}" -p "${process.env.CRON_SCHEDULE}" -l`,
|
||||||
instances: 1,
|
instances: 1,
|
||||||
watch: false,
|
watch: false,
|
||||||
autorestart: true
|
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 };
|
||||||
Reference in New Issue
Block a user