fix: project can not be started

This commit is contained in:
chenos 2021-10-29 13:04:44 +08:00
parent 51e83c1476
commit 980d848196
3 changed files with 21 additions and 17 deletions

View File

@ -4,26 +4,29 @@ ADMINER_PORT=8080
DB_MYSQL_PORT=3306 DB_MYSQL_PORT=3306
DB_POSTGRES_PORT=5432 DB_POSTGRES_PORT=5432
VERDACCIO_PORT=4873 VERDACCIO_PORT=4873
APP_PORT=23001 APP_PORT=13001
API_PORT=23002 API_PORT=13002
########## NOCOBASE ENV ########## ########## NOCOBASE ENV ##########
# DATABASE # DATABASE
DB_DIALECT=postgres DB_DIALECT=sqlite
DB_HOST=localhost DB_STORAGE=db.sqlite
DB_PORT=5432
DB_DATABASE=nocobase # DB_DIALECT=postgres
DB_USER=nocobase # DB_HOST=localhost
DB_PASSWORD=nocobase # DB_PORT=5432
# DB_DATABASE=nocobase
# DB_USER=nocobase
# DB_PASSWORD=nocobase
# set to 'on' to enable log # set to 'on' to enable log
DB_LOG_SQL= DB_LOG_SQL=
# API & APP # API & APP
NOCOBASE_ENV= NOCOBASE_ENV=
API_PORT=23000
APP_USE_STATIC_SERVER=true APP_USE_STATIC_SERVER=true
APP_DIST=packages/app/dist APP_DIST=packages/app/dist
@ -39,7 +42,7 @@ STORAGE_TYPE=local
# LOCAL STORAGE # LOCAL STORAGE
LOCAL_STORAGE_USE_STATIC_SERVER=true 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
ALI_OSS_STORAGE_BASE_URL= ALI_OSS_STORAGE_BASE_URL=

View File

@ -1,19 +1,20 @@
import { defineConfig } from 'dumi'; 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({ export default defineConfig({
title: ' ', title: ' ',
hash: true, hash: true,
define: { 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, 'process.env.API_HOSTNAME': process.env.API_HOSTNAME,
}, },
proxy: { proxy: {
'/api/': { '/api/': {
'target': `http://localhost:${process.env.API_PORT}/`, target: baseUrl,
'changeOrigin': true, changeOrigin: true,
'pathRewrite': { '^/api/': '/api/' }, pathRewrite: { '^/api/': '/api/' },
}, },
}, },
resolve: { resolve: {
@ -44,7 +45,7 @@ export default defineConfig({
top: 150px !important; top: 150px !important;
} }
} }
` `,
], ],
// mfsu: {}, // mfsu: {},
// ssr: {}, // ssr: {},

View File

@ -8,7 +8,7 @@
"bootstrap": "lerna bootstrap", "bootstrap": "lerna bootstrap",
"clean": "lerna clean", "clean": "lerna clean",
"examples": "ts-node-dev -r dotenv/config ./examples", "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-client": "cd packages/app && npm run start-client",
"start-server": "ts-node-dev -r dotenv/config ./packages/app/src/apis/index.ts", "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", "nocobase": "ts-node-dev -r dotenv/config ./packages/app/src/apis/index.ts",