mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 02:13:00 +08:00
fix(server): read the .env file on time (#12051)
This commit is contained in:
@@ -132,4 +132,8 @@ export class Env implements AppEnv {
|
||||
}
|
||||
}
|
||||
|
||||
globalThis.env = new Env();
|
||||
export const createGlobalEnv = () => {
|
||||
if (!globalThis.env) {
|
||||
globalThis.env = new Env();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'reflect-metadata';
|
||||
import './env';
|
||||
|
||||
import { existsSync, readFileSync } from 'node:fs';
|
||||
import { homedir } from 'node:os';
|
||||
@@ -7,6 +6,8 @@ import { join } from 'node:path';
|
||||
|
||||
import { config } from 'dotenv';
|
||||
|
||||
import { createGlobalEnv } from './env';
|
||||
|
||||
const CUSTOM_CONFIG_PATH = `${homedir()}/.affine/config`;
|
||||
|
||||
function loadPrivateKey() {
|
||||
@@ -37,3 +38,4 @@ function load() {
|
||||
}
|
||||
|
||||
load();
|
||||
createGlobalEnv();
|
||||
|
||||
Reference in New Issue
Block a user