feat: 优化配置管理和lint内容
This commit is contained in:
parent
5fff688612
commit
c32bbd9124
@ -16,11 +16,15 @@ services:
|
|||||||
- xiaoju-survey
|
- xiaoju-survey
|
||||||
|
|
||||||
xiaoju-survey:
|
xiaoju-survey:
|
||||||
image: "xiaojusurvey/xiaoju-survey:1.0.0"
|
image: "xiaojusurvey/xiaoju-survey:1.0.3"
|
||||||
container_name: xiaoju-survey
|
container_name: xiaoju-survey
|
||||||
restart: always
|
restart: always
|
||||||
ports:
|
ports:
|
||||||
- "8080:3000" # API端口
|
- "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:
|
links:
|
||||||
- mongo:mongo
|
- mongo:mongo
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -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
|
|
@ -33,7 +33,6 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"cheerio": "^1.0.0-rc.12",
|
"cheerio": "^1.0.0-rc.12",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"dotenv": "^16.3.1",
|
|
||||||
"glob": "^10.3.10",
|
"glob": "^10.3.10",
|
||||||
"joi": "^17.9.2",
|
"joi": "^17.9.2",
|
||||||
"jsonwebtoken": "^9.0.1",
|
"jsonwebtoken": "^9.0.1",
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
const mongo = {
|
const mongo = {
|
||||||
url: process.env.XIAOJU_SURVEY_MONGO_URL || 'mongodb://localhost:27017',
|
url: process.env.XIAOJU_SURVEY_MONGO_URL || 'mongodb://localhost:27017',
|
||||||
dbName: process.env.XIAOJU_SURVER_MONGO_DBNAME || 'xiaojuSurvey',
|
dbName: process.env.XIAOJU_SURVER_MONGO_DBNAME || 'xiaojuSurvey',
|
||||||
}
|
};
|
||||||
|
|
||||||
const session = {
|
const session = {
|
||||||
expireTime: parseInt(process.env.XIAOJU_SURVEY_JWT_EXPIRES_IN) || 8 * 3600 * 1000
|
expireTime: parseInt(process.env.XIAOJU_SURVEY_JWT_EXPIRES_IN) || 8 * 3600 * 1000
|
||||||
}
|
};
|
||||||
|
|
||||||
const encrypt = {
|
const encrypt = {
|
||||||
type: process.env.XIAOJU_SURVEY_ENCRYPT_TYPE || 'aes',
|
type: process.env.XIAOJU_SURVEY_ENCRYPT_TYPE || 'aes',
|
||||||
aesCodelength: parseInt(process.env.XIAOJU_SURVEY_ENCRYPT_TYPE_LEN) || 10 //aes密钥长度
|
aesCodelength: parseInt(process.env.XIAOJU_SURVEY_ENCRYPT_TYPE_LEN) || 10 //aes密钥长度
|
||||||
}
|
};
|
||||||
|
|
||||||
const jwt = {
|
const jwt = {
|
||||||
secret: process.env.XIAOJU_SURVEY_JWT_SECRET || 'xiaojuSurveyJwtSecret',
|
secret: process.env.XIAOJU_SURVEY_JWT_SECRET || 'xiaojuSurveyJwtSecret',
|
||||||
expiresIn: process.env.XIAOJU_SURVEY_JWT_EXPIRES_IN || '8h'
|
expiresIn: process.env.XIAOJU_SURVEY_JWT_EXPIRES_IN || '8h'
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
export{
|
export{
|
||||||
@ -23,4 +23,4 @@ export{
|
|||||||
session,
|
session,
|
||||||
encrypt,
|
encrypt,
|
||||||
jwt,
|
jwt,
|
||||||
}
|
};
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import 'dotenv/config';
|
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as Koa from 'koa';
|
import * as Koa from 'koa';
|
||||||
import * as KoaBodyparser from 'koa-bodyparser';
|
import * as KoaBodyparser from 'koa-bodyparser';
|
||||||
|
Loading…
Reference in New Issue
Block a user