vue: allow both http and https configuration (#2)

This closes #2

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Gregor Riepl 2019-09-20 08:41:04 +02:00 committed by Rohit Yadav
parent 05de01c844
commit 4c1de537a7
3 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,7 @@
CS_URL=http://localhost:8080
PUBLIC_HOST=primate.example.com
HTTPS_CERT=/etc/ssl/certs/primate.example.com.pem
HTTPS_KEY=/etc/ssl/private/primate.example.com.key
HTTPS_CA=/etc/ssl/certs/ca.pem
HTTPS_DHPARAM=/etc/ssl/keys/dh2048.pem
ALLOWED_HOSTS=["primate.example.com","cloud.example.com"]

View File

@ -30,6 +30,8 @@ Override the default `CS_URL` to a running CloudStack management server:
cp .env.local.example .env.local
Change the `CS_URL` in the `.env.local` file
To configure https, you may use `.env.local.https.example`.
Build and run:
npm start

View File

@ -17,6 +17,7 @@
const path = require('path')
const webpack = require('webpack')
const fs = require('fs')
function resolve (dir) {
return path.join(__dirname, dir)
@ -114,7 +115,15 @@ module.exports = {
ws: false,
changeOrigin: true
}
}
},
https: process.env.HTTPS_KEY ? {
key: process.env.HTTPS_KEY ? fs.readFileSync(process.env.HTTPS_KEY) : undefined,
cert: process.env.HTTPS_CERT ? fs.readFileSync(process.env.HTTPS_CERT) : undefined,
ca: process.env.HTTPS_CA ? fs.readFileSync(process.env.HTTPS_CA) : undefined,
dhparam: process.env.HTTPS_DHPARAM ? fs.readFileSync(process.env.HTTPS_DHPARAM) : undefined
} : false,
public: process.env.PUBLIC_HOST || undefined,
allowedHosts: process.env.ALLOWED_HOSTS ? JSON.parse(process.env.ALLOWED_HOSTS) : undefined
},
lintOnSave: undefined,