fix: some env move to runtime inject

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2023-12-16 23:27:01 +08:00
parent 2e36973aff
commit a3510d2526
4 changed files with 8 additions and 9 deletions

View File

@@ -6,4 +6,3 @@ ALLOWED_ORIGINS=innei.ren,www.innei.ren
# must be 64bit # must be 64bit
ENCRYPT_KEY=593f62860255feb0a914534a43814b9809cc7534da7f5485cd2e3d3c8609acab ENCRYPT_KEY=593f62860255feb0a914534a43814b9809cc7534da7f5485cd2e3d3c8609acab
ENCRYPT_ENABLE=false ENCRYPT_ENABLE=false
CBOR_NATIVE_ACCELERATION_DISABLED=true

View File

@@ -21,11 +21,6 @@ module.exports = {
NODE_PATH: nodePath, NODE_PATH: nodePath,
MX_ENCRYPT_KEY: process.env.MX_ENCRYPT_KEY, MX_ENCRYPT_KEY: process.env.MX_ENCRYPT_KEY,
PORT: process.env.PORT, PORT: process.env.PORT,
// https://github.com/kriszyp/cbor-x/blob/master/node-index.js#L16 https://github.com/kriszyp/cbor-x/blob/master/node-index.js#L10
// ncc not support runtime require so disable ACCELERATION
CBOR_NATIVE_ACCELERATION_DISABLED: true,
}, },
}, },
], ],

View File

@@ -55,10 +55,15 @@ function registerGlobal() {
} }
} }
function nodeEnvInjection() {
// # https://github.com/kriszyp/cbor-x/blob/master/node-index.js#L16 https://github.com/kriszyp/cbor-x/blob/master/node-index.js#L10
// # ncc not support runtime require so disable ACCELERATION
process.env['CBOR_NATIVE_ACCELERATION_DISABLED'] = '1'
}
export function register() { export function register() {
registerGlobal() registerGlobal()
nodeEnvInjection()
registerJSONGlobal() registerJSONGlobal()
mkdirs() mkdirs()
} }

View File

@@ -12,7 +12,7 @@ services:
- JWT_SECRET - JWT_SECRET
- ENCRYPT_KEY - ENCRYPT_KEY
- ENCRYPT_ENABLE - ENCRYPT_ENABLE
- CBOR_NATIVE_ACCELERATION_DISABLED
volumes: volumes:
- ./data/mx-space:/root/.mx-space - ./data/mx-space:/root/.mx-space
ports: ports: