forked from ymm-tech/gods-pen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
36 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
const defaultConfig = require('./default') | ||
|
||
let config = Object.assign(defaultConfig, require('./' + (process.env.CODE_ENV || 'local'))) | ||
config.HOST = (config.HOST || '/').replace(/\/*$/, '/') | ||
|
||
;['VIEW_PATH', 'ADMIN_PATH', 'EDITOR_PATH', 'API_PATH'].map(k => { | ||
if (config[k] === '/') return | ||
if (/^(https?:)?\/\//.test(config[k])) return | ||
config[k] = config.HOST + config[k].replace(/^\/*|\/*$/g, '') + '/' | ||
if (/^(https?:)?\/\//.test(config[k])) { | ||
config[k] = config[k].replace(/\/*$/, '/') | ||
} else { | ||
config[k] = config[k].replace(/^\/*|\/*$/g, '/') | ||
} | ||
}) | ||
|
||
;['VIEW_NAME', 'ADMIN_NAME', 'EDITOR_NAME', 'API_NAME'].map(k => { | ||
let pk = k.replace('_NAME', '_PATH') | ||
config[k] = config[pk] === '/' || /\d+\.\d+\.\d+\.\d+(:\d+)?(\/)?$/.test(config[pk]) ? '' : config[pk].match(/([^/]+)\/?$/) ? config[pk].match(/([^/]+)\/?$/)[1] : 'unknow' | ||
}) | ||
config.VIEW_NAME = process.env.NODE_ENV === 'development' ? '' : (config.VIEW_PATH.match(/([^/]+)\/?$/) || ['', 'view'])[1] | ||
config.EDITOR_NAME = process.env.NODE_ENV === 'development' ? '' : (config.EDITOR_PATH.match(/([^/]+)\/?$/) || ['', 'editor'])[1] | ||
|
||
module.exports = config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,16 @@ | ||
/* | ||
* 在本地开发调试时,三个web项目和一个node项目都是在独立运行的 | ||
* 因此需要配置每个服务的本地访问地址,以使能互相调用/请求 | ||
* admin、editor、view、api 四个服务的默认端口号分别为 | ||
* 8567、8565、8566、7051,因此默认配置如下 | ||
* 如果还希望像先前只启动本项目(demo 模式)进行体验,将 API_PATH | ||
* 设置为 ‘https://godspen.ymm56.com/api/' 即可 | ||
*/ | ||
|
||
module.exports = { | ||
EDITOR_PATH: 'http://127.0.0.1:8565/', | ||
API_PATH: 'https://godspen.ymm56.com/api/', | ||
VIEW_PATH: 'http://127.0.0.1:8566/', | ||
EDITOR_PATH: 'http://127.0.0.1:8565/', // 编辑器访问地址 | ||
VIEW_PATH: 'http://127.0.0.1:8566/', // 页面客户端访问地址 | ||
ADMIN_PATH: 'http://127.0.0.1:8567/', // 管理后台访问地址 | ||
API_PATH: 'http://127.0.0.1:7051/api', // api 服务端访问地址 | ||
// API_PATH: 'https://godspen.ymm56.com/api/', // 启动demo模式,使用官方 api 服务 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* 对于三个web项目,在构建阶段,web项目不再需要启动本地服务,一般来说, | ||
* 构建完成后会将所有静态资源文件部署在同一个(nginx)服务下,因此, | ||
* web项目的默认访问路径就是域名加项目名,如 xxxx.com/admin, | ||
* xxxx.com/editor,如无更名要求,无需再配置 | ||
* | ||
* 对于 api 服务,服务启动以后,本地/内部访问地址为 http://127.0.0.1:7051/api, | ||
* 如果最终能通过 nginx 反代等操作使之与 web 服务同域名同端口号, | ||
* 则可以保持以下配置(无需配置)即可,否则,请将 API_PATH 配置为 api 服务外部实际访 | ||
* 问路径,如 http://abc.125:7051/api | ||
*/ | ||
|
||
module.exports = { | ||
} |