fix: API server address in electron (#1888)

Co-authored-by: himself65 <himself65@outlook.com>
This commit is contained in:
Peng Xiao 2023-04-12 13:26:42 +08:00 committed by GitHub
parent fb0d2992c2
commit ba4a2fc9d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 9 deletions

View File

@ -42,7 +42,7 @@ env:
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
AFFINE_GOOGLE_CLIENT_ID: ${{ secrets.AFFINE_GOOGLE_CLIENT_ID }}
AFFINE_GOOGLE_CLIENT_SECRET: ${{ secrets.AFFINE_GOOGLE_CLIENT_SECRET }}
NODE_API_SERVER: 'https://app.affine.pro'
API_SERVER_PROFILE: prod
jobs:
make-macos:

View File

@ -8,7 +8,7 @@ NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=
# absolute path to the block suite directory
LOCAL_BLOCK_SUITE=
# see next.config.js
NODE_API_SERVER=
API_SERVER_PROFILE=
# save workspace to idb
ENABLE_IDB_PROVIDER=1
PREFETCH_WORKSPACE=1

View File

@ -26,7 +26,7 @@ const profileTarget = {
dev: '100.84.105.99:11001',
test: '100.84.105.99:11001',
stage: '',
pro: 'http://pathfinder.affine.pro',
prod: 'http://app.affine.pro',
local: '127.0.0.1:3000',
};
@ -89,7 +89,8 @@ const nextConfig = {
gitVersion: getGitVersion(),
hash: getCommitHash(),
serverAPI:
profileTarget[process.env.NODE_API_SERVER || 'dev'] ?? profileTarget.dev,
profileTarget[process.env.API_SERVER_PROFILE || 'dev'] ??
profileTarget.dev,
editorVersion: require('./package.json').dependencies['@blocksuite/editor'],
...preset,
},
@ -117,7 +118,7 @@ const nextConfig = {
},
rewrites: async () => {
const [profile, target, desc] = getRedirectConfig(
process.env.NODE_API_SERVER
process.env.API_SERVER_PROFILE
);
console.info(`API request proxy to [${desc} Server]: ` + target);
return profile;

View File

@ -11,8 +11,8 @@
],
"scripts": {
"dev": "dev-web",
"dev:ac": "NODE_API_SERVER=ac yarn workspace @affine/web dev",
"dev:local": "NODE_API_SERVER=local yarn workspace @affine/web dev",
"dev:ac": "API_SERVER_PROFILE=ac yarn workspace @affine/web dev",
"dev:local": "API_SERVER_PROFILE=local yarn workspace @affine/web dev",
"dev:app": "yarn workspace @affine/electron dev:app",
"build": "yarn workspace @affine/web build",
"build:client": "yarn workspace @affine/client-app build:app",

View File

@ -50,7 +50,7 @@ const dev = await p.group(
);
const env = {
NODE_API_SERVER: dev.server,
API_SERVER_PROFILE: dev.server,
PATH: process.env.PATH,
NODE_ENV: 'development',
};

View File

@ -76,7 +76,7 @@ const config: PlaywrightTestConfig = {
ENABLE_DEBUG_PAGE: '1',
ENABLE_SUBPAGE: '1',
ENABLE_CHANGELOG: '1',
NODE_API_SERVER: 'local',
API_SERVER_PROFILE: 'local',
},
},
],