Load .env, prefer WEBUI secret, add build script
Load local .env in napcat-shell and prioritize NAPCAT_WEBUI_SECRET_KEY across the app. Changes include: - package.json: add build:shell:config script to build shell and copy env for dev builds. - packages/napcat-develop/config/.env and loadNapCat.cjs: update default WEBUI secret to `napcatqq` and set the same env in the loader. - packages/napcat-shell/napcat.ts: read config/.env into process.env at startup, rework pathWrapper/logger initialization, and minor formatting cleanups. - packages/napcat-webui-backend/index.ts: InitWebUi now prefers NAPCAT_WEBUI_SECRET_KEY from the environment (updates config and logs the change); only generates a random token if no env override and current token is default. These changes make it easier to override the WebUI token for development and ensure the token is propagated when building the shell for dev workflows.
This commit is contained in:
1 parent
ff93aa3dc7
commit
d511e2bb3f
5 files changed
+41
-14
No files matched your search
@@ -1,4 +1,4 @@
|
||||
NAPCAT_DISABLE_PIPE=1
|
||||
NAPCAT_DISABLE_MULTI_PROCESS=1
|
||||
NAPCAT_WEBUI_JWT_SECRET_KEY=napcat_dev_secret_key
|
||||
NAPCAT_WEBUI_SECRET_KEY=napcat
|
||||
NAPCAT_WEBUI_SECRET_KEY=napcatqq
|
||||
@@ -78,7 +78,7 @@ async function copyAll () {
|
||||
process.env.NAPCAT_WORKDIR = TARGET_DIR;
|
||||
// 开发环境使用固定密钥
|
||||
process.env.NAPCAT_WEBUI_JWT_SECRET_KEY = 'napcat_dev_secret_key';
|
||||
process.env.NAPCAT_WEBUI_SECRET_KEY = 'napcat';
|
||||
process.env.NAPCAT_WEBUI_SECRET_KEY = 'napcatqq';
|
||||
console.log('Loading NapCat module...');
|
||||
await import(pathToFileURL(NAPCAT_MJS_PATH).href);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user