From 83ff4db8c4835c027b2f7e972e39f7d23d8df061 Mon Sep 17 00:00:00 2001 From: whyour Date: Wed, 5 May 2021 19:02:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=BB=98=E8=AE=A4cron?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 1 + back/config/index.ts | 1 + back/schedule.ts | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 4e961a4e..c09d375c 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,7 @@ MONGODB_URI='mongodb://' YIYAN_MONGODB_URI='' +CRON_PORT=5500 PORT=5600 LOG_LEVEL='debug' diff --git a/back/config/index.ts b/back/config/index.ts index 50cdf73c..17c55ac4 100644 --- a/back/config/index.ts +++ b/back/config/index.ts @@ -27,6 +27,7 @@ if (envFound.error) { export default { port: parseInt(process.env.PORT as string, 10), + cronPort: parseInt(process.env.CRON_PORT as string, 10), secret: process.env.SECRET, logs: { level: process.env.LOG_LEVEL || 'silly', diff --git a/back/schedule.ts b/back/schedule.ts index 7af003bd..1b99e5e6 100644 --- a/back/schedule.ts +++ b/back/schedule.ts @@ -5,6 +5,7 @@ import Logger from './loaders/logger'; import { Container } from 'typedi'; import CronService from './services/cron'; import { CrontabStatus } from './data/cron'; +import config from './config'; const app = express(); @@ -44,11 +45,11 @@ const run = async () => { }; app - .listen(5800, () => { + .listen(config.cronPort, () => { run(); Logger.info(` ################################################ - 🛡️ Schedule listening on port: 5800 🛡️ + 🛡️ Schedule listening on port: ${config.cronPort} 🛡️ ################################################ `); })