-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathserver.js
More file actions
50 lines (46 loc) · 1.73 KB
/
Copy pathserver.js
File metadata and controls
50 lines (46 loc) · 1.73 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Copyright (c) 2020-2024 Reminano */
/**
* Created by A on 7/18/17.
*/
'use strict';
require('dotenv').config();
const Logger = require('./utils/logging');
const Glue = require('glue');
const Routes = require('./config/routes');
const Manifest = require('./config/manifest');
const AppConfig = require('./config/app');
const CronJob = require('./cron/index');
const { reportToTelegram } = require('./ThirdParty/TelegramBot/TelegramBotFunctions');
require('./ThirdParty/BOTradingBinanceWS/klineWS'); //websocket
//tam thoi khong can su dung trading view
// require('./ThirdParty/TradingViewWS/TradingViewClient');
// const MQTTClient = require('./ThirdParty/MQTTClient/MQTTClient');
// const { createCheckoutPayment } = require('./ThirdParty/SunpayGateway/SunpayGatewayFunction');
if (process.env.MQTT_BROKER_ENABLE * 1 === 1) {
// const MQTTBroker = require('./ThirdParty/MQTTBroker/MQTTBroker');
}
if (process.env.SOCKETIO_ENABLE * 1 === 1) {
const SocketIO = require('./ThirdParty/SocketIO/SocketIO');
const SocketIOClient = require('./ThirdParty/SocketIO/SocketIOClient');
}
Glue.compose(Manifest, { relativeTo: __dirname }, (err, server) => {
if (err) {
throw err;
}
server.start(() => {
Logger.info('Server running at:', server.info.uri);
Logger.info('Server time: ' + new Date());
reportToTelegram(`Khởi động máy chủ: ${new Date()}`);
// createCheckoutPayment(5, 1000000);
if (process.env.NODE_ENV && process.env.NODE_ENV !== 'dev') {
if (process.env.WORKER_ENABLE && process.env.WORKER_ENABLE * 1 === 1) {
CronJob.startSchedule();
}
}
});
server.auth.strategy('jwt', 'jwt', {
key: AppConfig.jwt.secret,
verifyOptions: { algorithms: ['HS256'] },
});
server.route(Routes);
});