-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
37 lines (30 loc) · 1022 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as dotenv from 'dotenv';
dotenv.config();
import ecoModeService from './build/services/eco-mode-service.js';
import { createCronJob } from './common/services/cron-job.js';
import github from './common/services/github.js';
import { logger } from './common/services/logger.js';
import { config } from './config.js';
import { deploy } from './run/services/deploy.js';
import { taskScheduler } from './run/services/task-scheduler.js';
import tasks from './run/services/tasks.js';
import server from './server.js';
const init = async () => {
await ecoModeService.start();
createCronJob(
'Deploy Pix site',
async () => {
const repoName = config.PIX_SITE_REPO_NAME;
const releaseTag = await github.getLatestReleaseTag(repoName);
deploy(repoName, config.PIX_SITE_APPS, releaseTag);
},
config.pixSiteDeploy.schedule,
);
taskScheduler(tasks);
await server.start();
logger.info({
event: 'main',
message: `Server running on "${server.info.uri}"`,
});
};
init();