From 980d84819607a1211210f2e1ac6b0cc0bcae4bc5 Mon Sep 17 00:00:00 2001 From: chenos Date: Fri, 29 Oct 2021 13:04:44 +0800 Subject: [PATCH] fix: project can not be started --- .env.example | 23 +++++++++++++---------- .umirc.ts | 13 +++++++------ package.json | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.env.example b/.env.example index 3964bc499..4eae24ace 100644 --- a/.env.example +++ b/.env.example @@ -4,26 +4,29 @@ ADMINER_PORT=8080 DB_MYSQL_PORT=3306 DB_POSTGRES_PORT=5432 VERDACCIO_PORT=4873 -APP_PORT=23001 -API_PORT=23002 +APP_PORT=13001 +API_PORT=13002 ########## NOCOBASE ENV ########## # DATABASE -DB_DIALECT=postgres -DB_HOST=localhost -DB_PORT=5432 -DB_DATABASE=nocobase -DB_USER=nocobase -DB_PASSWORD=nocobase +DB_DIALECT=sqlite +DB_STORAGE=db.sqlite + +# DB_DIALECT=postgres +# DB_HOST=localhost +# DB_PORT=5432 +# DB_DATABASE=nocobase +# DB_USER=nocobase +# DB_PASSWORD=nocobase + # set to 'on' to enable log DB_LOG_SQL= # API & APP NOCOBASE_ENV= -API_PORT=23000 APP_USE_STATIC_SERVER=true APP_DIST=packages/app/dist @@ -39,7 +42,7 @@ STORAGE_TYPE=local # LOCAL STORAGE LOCAL_STORAGE_USE_STATIC_SERVER=true -LOCAL_STORAGE_BASE_URL=http://localhost:23000 +LOCAL_STORAGE_BASE_URL=http://localhost:13002 # ALI OSS STORAGE ALI_OSS_STORAGE_BASE_URL= diff --git a/.umirc.ts b/.umirc.ts index 84e0b7d14..160aadbd1 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -1,19 +1,20 @@ import { defineConfig } from 'dumi'; -console.log('process.env.API_URL', process.env.API_URL) +const baseUrl = `http://localhost:${process.env.API_PORT || '13001'}/`; +console.log('baseUrl', baseUrl); export default defineConfig({ title: ' ', hash: true, define: { - 'process.env.API_URL': process.env.API_URL, + 'process.env.API_URL': process.env.API_URL || `${baseUrl}api/`, 'process.env.API_HOSTNAME': process.env.API_HOSTNAME, }, proxy: { '/api/': { - 'target': `http://localhost:${process.env.API_PORT}/`, - 'changeOrigin': true, - 'pathRewrite': { '^/api/': '/api/' }, + target: baseUrl, + changeOrigin: true, + pathRewrite: { '^/api/': '/api/' }, }, }, resolve: { @@ -44,7 +45,7 @@ export default defineConfig({ top: 150px !important; } } - ` + `, ], // mfsu: {}, // ssr: {}, diff --git a/package.json b/package.json index 023f9baf8..9e74c4d70 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "bootstrap": "lerna bootstrap", "clean": "lerna clean", "examples": "ts-node-dev -r dotenv/config ./examples", - "start": "concurrently \"npm run start-server\" \"npm run start-client\"", + "start": "concurrently \"npm run start-server\" \"npm run start-docs\"", "start-client": "cd packages/app && npm run start-client", "start-server": "ts-node-dev -r dotenv/config ./packages/app/src/apis/index.ts", "nocobase": "ts-node-dev -r dotenv/config ./packages/app/src/apis/index.ts",