修改初始化判断条件

This commit is contained in:
hanhh
2021-10-03 22:01:44 +08:00
parent 652c40ab1f
commit bb6ab0c17b
3 changed files with 24 additions and 12 deletions
+7 -5
View File
@@ -5,7 +5,7 @@ import routes from '../api';
import config from '../config';
import jwt from 'express-jwt';
import fs from 'fs';
import { getPlatform, getToken } from '../config/util';
import { getFileContentByName, getPlatform, getToken } from '../config/util';
import Container from 'typedi';
import OpenService from '../services/open';
import rewrite from 'express-urlrewrite';
@@ -90,12 +90,14 @@ export default ({ app }: { app: Application }) => {
}
const userService = Container.get(UserService);
const authInfo = await userService.getUserInfo();
const envDbContent = getFileContentByName(config.envDbFile);
let isInitialized = true;
if (
!authInfo ||
(Object.keys(authInfo).length === 2 &&
authInfo.username === 'admin' &&
authInfo.password === 'admin')
Object.keys(authInfo).length === 2 &&
authInfo.username === 'admin' &&
authInfo.password === 'admin' &&
envDbContent.length === 0
) {
isInitialized = false;
}