feat: 优化配置管理和lint内容

This commit is contained in:
sudoooooo 2024-01-17 15:16:33 +08:00
parent 5fff688612
commit c32bbd9124
5 changed files with 10 additions and 24 deletions

View File

@ -16,11 +16,15 @@ services:
- xiaoju-survey
xiaoju-survey:
image: "xiaojusurvey/xiaoju-survey:1.0.0"
image: "xiaojusurvey/xiaoju-survey:1.0.3"
container_name: xiaoju-survey
restart: always
ports:
- "8080:3000" # API端口
environment:
XIAOJU_SURVEY_MONGO_URL: mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@xiaoju-survey-mongo:27017 # docker-compose 会根据容器名称自动处理
XIAOJU_SURVEY_JWT_SECRET: surveyEngineJwtSecret
XIAOJU_SURVEY_JWT_EXPIRES_IN: 8h
links:
- mongo:mongo
depends_on:

View File

@ -1,16 +0,0 @@
# mongo
XIAOJU_SURVEY_MONGO_URL=mongodb://localhost:27017
XIAOJU_SURVER_MONGO_DBNAME=xiaojuSurvey
# session
# 8 * 3600 * 1000
XIAOJU_SURVEY_SESSION_EXPIRE_TIME=28800000
# encrypt
XIAOJU_SURVEY_ENCRYPT_TYPE=aes
XIAOJU_SURVEY_ENCRYPT_SECRET_KEY=dataAesEncryptSecretKey
XIAOJU_SURVEY_ENCRYPT_TYPE_LEN=10
# jwt
XIAOJU_SURVEY_JWT_SECRET=xiaojuSurveyJwtSecret
XIAOJU_SURVEY_JWT_EXPIRES_IN=8h

View File

@ -33,7 +33,6 @@
"dependencies": {
"cheerio": "^1.0.0-rc.12",
"crypto-js": "^4.2.0",
"dotenv": "^16.3.1",
"glob": "^10.3.10",
"joi": "^17.9.2",
"jsonwebtoken": "^9.0.1",

View File

@ -1,21 +1,21 @@
const mongo = {
url: process.env.XIAOJU_SURVEY_MONGO_URL || 'mongodb://localhost:27017',
dbName: process.env.XIAOJU_SURVER_MONGO_DBNAME || 'xiaojuSurvey',
}
};
const session = {
expireTime: parseInt(process.env.XIAOJU_SURVEY_JWT_EXPIRES_IN) || 8 * 3600 * 1000
}
};
const encrypt = {
type: process.env.XIAOJU_SURVEY_ENCRYPT_TYPE || 'aes',
aesCodelength: parseInt(process.env.XIAOJU_SURVEY_ENCRYPT_TYPE_LEN) || 10 //aes密钥长度
}
};
const jwt = {
secret: process.env.XIAOJU_SURVEY_JWT_SECRET || 'xiaojuSurveyJwtSecret',
expiresIn: process.env.XIAOJU_SURVEY_JWT_EXPIRES_IN || '8h'
}
};
export{
@ -23,4 +23,4 @@ export{
session,
encrypt,
jwt,
}
};

View File

@ -1,4 +1,3 @@
import 'dotenv/config';
import * as os from 'os';
import * as Koa from 'koa';
import * as KoaBodyparser from 'koa-bodyparser';