Skip to content

Commit 4c1de53

Browse files
srgonirohityadavcloud
authored andcommitted
vue: allow both http and https configuration (#2)
This closes #2 Signed-off-by: Rohit Yadav <[email protected]>
1 parent 05de01c commit 4c1de53

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

ui/.env.local.https.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CS_URL=http://localhost:8080
2+
PUBLIC_HOST=primate.example.com
3+
HTTPS_CERT=/etc/ssl/certs/primate.example.com.pem
4+
HTTPS_KEY=/etc/ssl/private/primate.example.com.key
5+
HTTPS_CA=/etc/ssl/certs/ca.pem
6+
HTTPS_DHPARAM=/etc/ssl/keys/dh2048.pem
7+
ALLOWED_HOSTS=["primate.example.com","cloud.example.com"]

ui/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Override the default `CS_URL` to a running CloudStack management server:
3030
cp .env.local.example .env.local
3131
Change the `CS_URL` in the `.env.local` file
3232

33+
To configure https, you may use `.env.local.https.example`.
34+
3335
Build and run:
3436

3537
npm start

ui/vue.config.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
const path = require('path')
1919
const webpack = require('webpack')
20+
const fs = require('fs')
2021

2122
function resolve (dir) {
2223
return path.join(__dirname, dir)
@@ -114,7 +115,15 @@ module.exports = {
114115
ws: false,
115116
changeOrigin: true
116117
}
117-
}
118+
},
119+
https: process.env.HTTPS_KEY ? {
120+
key: process.env.HTTPS_KEY ? fs.readFileSync(process.env.HTTPS_KEY) : undefined,
121+
cert: process.env.HTTPS_CERT ? fs.readFileSync(process.env.HTTPS_CERT) : undefined,
122+
ca: process.env.HTTPS_CA ? fs.readFileSync(process.env.HTTPS_CA) : undefined,
123+
dhparam: process.env.HTTPS_DHPARAM ? fs.readFileSync(process.env.HTTPS_DHPARAM) : undefined
124+
} : false,
125+
public: process.env.PUBLIC_HOST || undefined,
126+
allowedHosts: process.env.ALLOWED_HOSTS ? JSON.parse(process.env.ALLOWED_HOSTS) : undefined
118127
},
119128

120129
lintOnSave: undefined,

0 commit comments

Comments
 (0)