File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
swift_browser_ui_frontend Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -78,3 +78,8 @@ VAULT_URL=http://localhost:8200/v1
78
78
VAULT_ROLE = swiftbrowserui
79
79
VAULT_SECRET = swiftui
80
80
VAULT_KEY_NAME = human-readable-short-string-to-identify-the-whitelisted-key
81
+
82
+ VITE_TLS = False
83
+ # paths should be absolute or relative to vite.config.js
84
+ VITE_TLS_CERT =
85
+ VITE_TLS_KEY =
Original file line number Diff line number Diff line change 2
2
import { defineConfig } from "vite" ;
3
3
import { createVuePlugin as vue } from "vite-plugin-vue2" ;
4
4
5
+ import fs from "node:fs" ;
5
6
import path from "node:path" ;
6
7
8
+ const TLS_ENABLED = process . env . VITE_TLS === "True" ;
9
+ const http_mode = TLS_ENABLED ? "https" : "http" ;
10
+ // paths should be absolute or relative to vite.config.js
11
+ const TLS_CERT_PATH = process . env . VITE_TLS_CERT || undefined ;
12
+ const TLS_KEY_PATH = process . env . VITE_TLS_KEY || undefined ;
13
+
14
+ let https = null ;
15
+ if ( TLS_ENABLED ) {
16
+ console . log ( "vite dev serve will expect https" ) ;
17
+ https = {
18
+ key : fs . readFileSync ( TLS_KEY_PATH ) ,
19
+ cert : fs . readFileSync ( TLS_CERT_PATH ) ,
20
+ } ;
21
+ }
22
+
7
23
const proxyTo = {
8
- target : `http ://${ process . env . BACKEND_HOST || "localhost" } :${ process . env . BACKEND_PORT || "8080" } ` ,
24
+ target : `${ http_mode } ://${ process . env . BACKEND_HOST || "localhost" } :${ process . env . BACKEND_PORT || "8080" } ` ,
9
25
changeOrigin : true ,
10
26
secure : false , // Won't check certificates
11
27
} ;
@@ -101,6 +117,7 @@ export default defineConfig(({ command, mode }) => {
101
117
server : {
102
118
host : "0.0.0.0" ,
103
119
port : process . env . FRONTEND_PORT || "8081" ,
120
+ https,
104
121
strictPort : true ,
105
122
proxy : {
106
123
"/static/assets" : proxyTo ,
You can’t perform that action at this time.
0 commit comments