Skip to content

Commit 0f3fe17

Browse files
authored
chore: remove dotenv promotion log (#665)
Signed-off-by: Bob Du <[email protected]>
1 parent a594fad commit 0f3fe17

File tree

7 files changed

+1
-19
lines changed

7 files changed

+1
-19
lines changed

service/src/chatgpt/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type { TextAuditService } from '../utils/textAudit'
55
import type { ChatMessage, RequestOptions } from './types'
66
import { tavily } from '@tavily/core'
77
import dayjs from 'dayjs'
8-
import * as dotenv from 'dotenv'
98
import OpenAI from 'openai'
109
import * as undici from 'undici'
1110
import { getCacheApiKeys, getCacheConfig, getOriginConfig } from '../storage/config'
@@ -16,8 +15,6 @@ import { convertImageUrl } from '../utils/image'
1615
import { hasAnyRole, isNotEmptyString } from '../utils/is'
1716
import { textAuditServices } from '../utils/textAudit'
1817

19-
dotenv.config()
20-
2118
function renderSystemMessage(template: string, currentTime: string): string {
2219
return template.replace(/\{current_time\}/g, currentTime)
2320
}

service/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import { hasAnyRole, isEmail, isNotEmptyString } from './utils/is'
4848
import { sendNoticeMail, sendResetPasswordMail, sendTestMail, sendVerifyMail, sendVerifyMailAdmin } from './utils/mail'
4949
import { checkUserResetPassword, checkUserVerify, checkUserVerifyAdmin, getUserResetPasswordUrl, getUserVerifyUrl, getUserVerifyUrlAdmin, md5 } from './utils/security'
5050

51-
dotenv.config()
51+
dotenv.config({ quiet: true })
5252

5353
const app = express()
5454
const router = express.Router()

service/src/middleware/limiter.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import type { RequestHandler } from 'express'
22
import type { Options } from 'express-rate-limit'
33
import * as process from 'node:process'
4-
import * as dotenv from 'dotenv'
54
import { rateLimit } from 'express-rate-limit'
65
import requestIp from 'request-ip'
76
import { isNotEmptyString } from '../utils/is'
87

9-
dotenv.config()
10-
118
const MAX_REQUEST_PER_HOUR = process.env.MAX_REQUEST_PER_HOUR
129
const AUTH_MAX_REQUEST_PER_MINUTE = process.env.AUTH_MAX_REQUEST_PER_MINUTE
1310

service/src/middleware/rootAuth.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import type { AuthJwtPayload } from '../types'
2-
import * as dotenv from 'dotenv'
32
import jwt from 'jsonwebtoken'
43
import { authProxyHeaderName, getCacheConfig } from '../storage/config'
54
import { Status, UserRole } from '../storage/model'
65
import { getUser, getUserById } from '../storage/mongo'
76

8-
dotenv.config()
9-
107
async function rootAuth(req, res, next) {
118
const config = await getCacheConfig()
129

service/src/storage/config.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import type { TextAuditServiceProvider } from 'src/utils/textAudit'
22
import * as process from 'node:process'
3-
import * as dotenv from 'dotenv'
43
import { ObjectId } from 'mongodb'
54
import { isNotEmptyString, isTextAuditServiceProvider } from '../utils/is'
65
import { AdvancedConfig, AnnounceConfig, AuditConfig, Config, KeyConfig, MailConfig, SearchConfig, SiteConfig, TextAudioType, UserRole } from './model'
76
import { getConfig, getKeys, upsertKey } from './mongo'
87

9-
dotenv.config()
10-
118
let cachedConfig: Config | undefined
129
let cacheExpiration = 0
1310

service/src/storage/mongo.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ import type {
1212
} from './model'
1313
import * as process from 'node:process'
1414
import dayjs from 'dayjs'
15-
import * as dotenv from 'dotenv'
1615
import { MongoClient, ObjectId } from 'mongodb'
1716
import { md5 } from '../utils/security'
1817
import { getCacheConfig } from './config'
1918
import { ChatInfo, ChatRoom, ChatUsage, Status, UserConfig, UserInfo, UserRole } from './model'
2019

21-
dotenv.config()
22-
2320
const url = process.env.MONGODB_URL
2421

2522
let client: MongoClient

service/src/utils/security.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { createHash } from 'node:crypto'
22
import * as process from 'node:process'
3-
import * as dotenv from 'dotenv'
43
import { getCacheConfig } from '../storage/config'
54

6-
dotenv.config()
7-
85
export function md5(input: string) {
96
input = input + process.env.PASSWORD_MD5_SALT
107
const md5 = createHash('md5')

0 commit comments

Comments
 (0)