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 env = loadEnv(mode, process.cwd(), '')
|
||||||
const backendHost = env.VITE_BACKEND_HOST ?? '127.0.0.1'
|
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 {
|
return {
|
||||||
plugins: [vue()],
|
plugins: [vue()],
|
||||||
server: {
|
server: {
|
||||||
host: '0.0.0.0',
|
host: '0.0.0.0',
|
||||||
https: {
|
https: httpsConfig,
|
||||||
key: fs.readFileSync('./key.pem'),
|
|
||||||
cert: fs.readFileSync('./cert.pem'),
|
|
||||||
},
|
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: `http://${backendHost}:5000`,
|
target: `http://${backendHost}:5000`,
|
||||||
|
|||||||
Reference in New Issue
Block a user