fix(server): selfhost startup (#9386)

This commit is contained in:
liuyi
2024-12-27 19:29:17 +08:00
committed by GitHub
parent 8bceece5b1
commit a16471c185
4 changed files with 17 additions and 4 deletions

View File

@@ -45,6 +45,7 @@ function loadPrivateKey() {
}
async function load() {
let isPrivateKeyFromEnv = !!process.env.AFFINE_PRIVATE_KEY;
// Initializing AFFiNE config
//
// 1. load dotenv file to `process.env`
@@ -56,6 +57,12 @@ async function load() {
path: join(CUSTOM_CONFIG_PATH, '.env'),
});
// @deprecated
// The old AFFINE_PRIVATE_KEY in old .env is somehow not working, we should ignore it
if (!isPrivateKeyFromEnv) {
delete process.env.AFFINE_PRIVATE_KEY;
}
// 2. generate AFFiNE default config and assign to `globalThis.AFFiNE`
globalThis.AFFiNE = getAFFiNEConfigModifier();
const { enablePlugin } = await import('./plugins/registry');