Skip to content
Snippets Groups Projects
Commit 2f6b8fae authored by Lukáš Kratochvíl's avatar Lukáš Kratochvíl
Browse files

fix: client - safe way of defining env variables

parent 4ef21c8a
No related branches found
No related tags found
No related merge requests found
......@@ -81,12 +81,16 @@ services:
- ./frontend:/usr/src/app
# this prevents our host files from overriding container's node_modules
- exclude-client:/usr/src/app/node_modules/
environment:
- PORT=${CLIENT_PORT}
# all the traffic goes through Nginx server
- SERVER_PORT=${NGINX_PORT}
restart: always
networks:
backend-network:
volumes:
database-storage:
exclude-server:
exclude-client:
networks:
backend-network:
......@@ -2,16 +2,12 @@ import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default ({ mode }) => {
process.env = {...process.env, ...loadEnv(mode, `../${process.cwd()}`, '')};
return defineConfig({
plugins: [react()],
server: {
watch: {
usePolling: true
},
port: +process.env.CLIENT_PORT
}
});
}
export default defineConfig({
plugins: [react()],
server: {
watch: {
usePolling: true
},
port: +process.env.PORT
}
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment