diff --git a/docker-compose.yml b/docker-compose.yml index 6678e8f..4bc375c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,4 +7,7 @@ services: - ./:/app/ ports: - "7001:3000" + environment: + - VITE_DJANGO_BASE_URL=http://localhost:7000 + - VITE_API_IMPLEMENTATION=django diff --git a/src/services/api-implementation.js b/src/services/api-implementation.js index 0bbbec6..2360e3f 100644 --- a/src/services/api-implementation.js +++ b/src/services/api-implementation.js @@ -3,7 +3,7 @@ import Api from './api'; class ApiImplementation { constructor() { - const implementation = process.env.API_IMPLEMENTATION; + const implementation = import.meta.env.VITE_API_IMPLEMENTATION; let apiImplementation; if (implementation === 'django') { apiImplementation = new DjangoApi(); diff --git a/src/services/django-api.js b/src/services/django-api.js index b760b75..7181942 100644 --- a/src/services/django-api.js +++ b/src/services/django-api.js @@ -1,6 +1,6 @@ class DjangoApi { constructor() { - this.base = process.env.DJANGO_BASE_URL; + this.base = import.meta.env.VITE_DJANGO_BASE_URL; } getCustomers() { diff --git a/vite.config.mjs b/vite.config.mjs index a638475..a1a9dec 100644 --- a/vite.config.mjs +++ b/vite.config.mjs @@ -47,8 +47,6 @@ export default defineConfig({ }), ], define: { 'process.env': { - API_IMPLEMENTATION: 'django', - DJANGO_BASE_URL: 'http://localhost:7000' } }, resolve: { alias: {