fix: 修复使用 .env 时 /api/utils/env 接口中的 env 字段为空的问题

This commit is contained in:
Aritro37 2025-03-19 15:07:01 +08:00 committed by GitHub
parent 6c54518e84
commit ff5283a66f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -19,10 +19,6 @@ console.log(
`, `,
); );
if ($.env.isNode) {
const dotenv = eval(`require("dotenv")`);
dotenv.config();
}
import migrate from '@/utils/migration'; import migrate from '@/utils/migration';
import serve from '@/restful'; import serve from '@/restful';

View File

@ -18,6 +18,10 @@ export class OpenAPI {
this.http = HTTP(); this.http = HTTP();
this.env = ENV(); this.env = ENV();
if (isNode) {
const dotenv = eval(`require("dotenv")`);
dotenv.config();
}
this.node = (() => { this.node = (() => {
if (isNode) { if (isNode) {
const fs = eval("require('fs')"); const fs = eval("require('fs')");