up
This commit is contained in:
parent
199b6c4acd
commit
b073f3185f
22
ConfigBasic.js
Normal file
22
ConfigBasic.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
module.exports={
|
||||||
|
protocol: 'http',
|
||||||
|
host: 'localhost',
|
||||||
|
port: undefined,
|
||||||
|
// 如果使用 https 协议,必须填写以下内容,或在命令行参数中设置:
|
||||||
|
sslType: 'greenlock', // greenlock or file
|
||||||
|
sslDomainList: ['localhost'],
|
||||||
|
sslKey: undefined, // '/etc/letsencrypt/live/HOST/privkey.pem', // ssl key file,
|
||||||
|
sslCert: undefined, // '/etc/letsencrypt/live/HOST/fullchain.pem', // ssl cert file,
|
||||||
|
sslCA: undefined, // '/etc/letsencrypt/live/HOST/bundle.pem', // ssl ca file,
|
||||||
|
|
||||||
|
deploy: {
|
||||||
|
type: 'web',
|
||||||
|
host: 'localhost', // 待部署到的主机
|
||||||
|
port: '22', // 带部署到的主机的 SSH 端口
|
||||||
|
dir: '/home/adot/APPNAME', // 待部署到的目录路径
|
||||||
|
dist: 'dist', // 待部署到的文件夹
|
||||||
|
user: 'adot', // 登录用户名
|
||||||
|
password: '', // 登录用户密码
|
||||||
|
key: `${process.env.HOME}/.ssh/id_rsa`, // 登录用户私钥文件
|
||||||
|
},
|
||||||
|
}
|
6
ConfigCustom.js
Normal file
6
ConfigCustom.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports={
|
||||||
|
// sslType: 'file',
|
||||||
|
// sslKey: '/etc/letsencrypt/live/HOST/privkey.pem', // ssl key file,
|
||||||
|
// sslCert: '/etc/letsencrypt/live/HOST/fullchain.pem', // ssl cert file,
|
||||||
|
// sslCA: '/etc/letsencrypt/live/HOST/bundle.pem', // ssl ca file,
|
||||||
|
}
|
@ -13,14 +13,20 @@ try {
|
|||||||
if (fs.existsSync(path.join(process.cwd(), './ConfigBasic.js'))) {
|
if (fs.existsSync(path.join(process.cwd(), './ConfigBasic.js'))) {
|
||||||
Config=require(path.join(process.cwd(), './ConfigBasic.js'))
|
Config=require(path.join(process.cwd(), './ConfigBasic.js'))
|
||||||
console.info('ConfigBasic loaded')
|
console.info('ConfigBasic loaded')
|
||||||
|
}else {
|
||||||
|
console.info('Missing and omitting ConfigBasic')
|
||||||
}
|
}
|
||||||
if (fs.existsSync(path.join(process.cwd(), './ConfigCustom.js'))) { // 如果存在,覆盖掉 ConfigBasic 里的默认参数
|
if (fs.existsSync(path.join(process.cwd(), './ConfigCustom.js'))) { // 如果存在,覆盖掉 ConfigBasic 里的默认参数
|
||||||
Config=deepmerge(Config, require(path.join(process.cwd(), './ConfigCustom.js'))) // 注意,objectMerge后,产生了一个新的对象,而不是在原来的Config里添加
|
Config=deepmerge(Config, require(path.join(process.cwd(), './ConfigCustom.js'))) // 注意,objectMerge后,产生了一个新的对象,而不是在原来的Config里添加
|
||||||
console.info('ConfigCustom loaded')
|
console.info('ConfigCustom loaded')
|
||||||
|
}else {
|
||||||
|
console.info('Missing and omitting ConfigCustom')
|
||||||
}
|
}
|
||||||
if (fs.existsSync(path.join(process.cwd(), './ConfigSecret.js'))) { // 如果存在,覆盖掉 ConfigBasic 和 ConfigCustom 里的参数
|
if (fs.existsSync(path.join(process.cwd(), './ConfigSecret.js'))) { // 如果存在,覆盖掉 ConfigBasic 和 ConfigCustom 里的参数
|
||||||
Config=deepmerge(Config, require(path.join(process.cwd(), './ConfigSecret.js')))
|
Config=deepmerge(Config, require(path.join(process.cwd(), './ConfigSecret.js')))
|
||||||
console.info('ConfigSecret loaded')
|
console.info('ConfigSecret loaded')
|
||||||
|
}else {
|
||||||
|
console.info('Missing and omitting ConfigSecret')
|
||||||
}
|
}
|
||||||
}catch(err){
|
}catch(err){
|
||||||
console.error('Loading config files failed: '+err.message)
|
console.error('Loading config files failed: '+err.message)
|
||||||
@ -82,7 +88,7 @@ async function init(){ /*** 设置全局对象 ***/
|
|||||||
server.use(require('compression')())
|
server.use(require('compression')())
|
||||||
|
|
||||||
/*** 路由 ***/
|
/*** 路由 ***/
|
||||||
server.use(require('express').static(path.join(__dirname, 'dist'), {index: 'index.html'}))
|
server.use(require('express').static(path.join(process.cwd(), 'dist'), {index: 'index.html'}))
|
||||||
// server.use(require('serve-favicon')(path.join(__dirname, 'public', 'favicon.ico'))) // uncomment after placing your favicon in /public
|
// server.use(require('serve-favicon')(path.join(__dirname, 'public', 'favicon.ico'))) // uncomment after placing your favicon in /public
|
||||||
|
|
||||||
let ipv4 = getMyIp()
|
let ipv4 = getMyIp()
|
||||||
|
Loading…
Reference in New Issue
Block a user