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

This closes #2

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
diff --git a/.env.local.https.example b/.env.local.https.example
new file mode 100644
index 0000000..f0ab16d
--- /dev/null
+++ b/.env.local.https.example
@@ -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"]
diff --git a/README.md b/README.md
index 3432ac0..0cabdb1 100644
--- a/README.md
+++ b/README.md
@@ -30,6 +30,8 @@
     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
diff --git a/vue.config.js b/vue.config.js
index c02cac9..ef4c105 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -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 @@
         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,