Merge pull request 'config(Deploy): use environment to config api server.' (#17) from config_environment_on_production into main

Reviewed-on: #17
This commit is contained in:
mono 2025-04-04 18:54:03 -05:00
commit e2ccfbcd5f
4 changed files with 5 additions and 4 deletions

View File

@ -7,4 +7,7 @@ services:
- ./:/app/
ports:
- "7001:3000"
environment:
- VITE_DJANGO_BASE_URL=http://localhost:7000
- VITE_API_IMPLEMENTATION=django

View File

@ -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();

View File

@ -1,6 +1,6 @@
class DjangoApi {
constructor() {
this.base = process.env.DJANGO_BASE_URL;
this.base = import.meta.env.VITE_DJANGO_BASE_URL;
}
getCustomers() {

View File

@ -47,8 +47,6 @@ export default defineConfig({
}),
],
define: { 'process.env': {
API_IMPLEMENTATION: 'django',
DJANGO_BASE_URL: 'http://localhost:7000'
} },
resolve: {
alias: {