refactor: simplify HTTPS configuration in Vite setup
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m41s
All checks were successful
Chore App Build, Test, and Push Docker Images / build-and-push (push) Successful in 2m41s
This commit is contained in:
@@ -7,14 +7,16 @@ export default defineConfig(({ mode }) => {
|
||||
const env = loadEnv(mode, process.cwd(), '')
|
||||
const backendHost = env.VITE_BACKEND_HOST ?? '127.0.0.1'
|
||||
|
||||
const httpsConfig =
|
||||
fs.existsSync('./key.pem') && fs.existsSync('./cert.pem')
|
||||
? { key: fs.readFileSync('./key.pem'), cert: fs.readFileSync('./cert.pem') }
|
||||
: undefined
|
||||
|
||||
return {
|
||||
plugins: [vue()],
|
||||
server: {
|
||||
host: '0.0.0.0',
|
||||
https: {
|
||||
key: fs.readFileSync('./key.pem'),
|
||||
cert: fs.readFileSync('./cert.pem'),
|
||||
},
|
||||
https: httpsConfig,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: `http://${backendHost}:5000`,
|
||||
|
||||
Reference in New Issue
Block a user