API URL per env setzen
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
# Environment variables for Bamort development environment
|
||||
|
||||
# API Configuration
|
||||
VITE_API_URL=http://localhost:8180
|
||||
|
||||
# Database Configuration (for development)
|
||||
DATABASE_TYPE=mysql
|
||||
DATABASE_URL=bamort:bG4)efozrc@tcp(mariadb:3306)/bamort?charset=utf8mb4&parseTime=True&loc=Local
|
||||
|
||||
# MariaDB Configuration (development)
|
||||
MARIADB_ROOT_PASSWORD=root_password_dev
|
||||
MARIADB_PASSWORD=bG4)efozrc
|
||||
|
||||
VITE_API_URL=http://192.168.0.48:8180
|
||||
@@ -6,4 +6,6 @@ MARIADB_ROOT_PASSWORD=your_secure_root_password_here
|
||||
MARIADB_PASSWORD=your_secure_user_password_here
|
||||
|
||||
# Application Configuration
|
||||
VITE_API_URL=http://localhost:8180
|
||||
|
||||
# Add other environment variables as needed
|
||||
|
||||
@@ -15,6 +15,11 @@ Diese Docker-Konfiguration ermöglicht es, die Bamort-Anwendung in einer Entwick
|
||||
|
||||
# Oder manuell
|
||||
docker-compose -f docker-compose.dev.yml up --build
|
||||
|
||||
# Mit benutzerdefinierten Umgebungsvariablen
|
||||
cp .env.example .env.dev
|
||||
# Bearbeite .env.dev nach Bedbedarf
|
||||
docker-compose -f docker-compose.dev.yml --env-file .env.dev up --build
|
||||
```
|
||||
|
||||
## Stoppen der Entwicklungsumgebung
|
||||
|
||||
@@ -35,12 +35,24 @@
|
||||
### Start Development Environment
|
||||
```bash
|
||||
cd /data/dev/bamort/docker
|
||||
|
||||
# Option 1: Use default configuration
|
||||
docker-compose -f docker-compose.dev.yml up -d
|
||||
|
||||
# Option 2: Use custom environment variables
|
||||
cp .env.example .env.dev
|
||||
# Edit .env.dev with your settings
|
||||
docker-compose -f docker-compose.dev.yml --env-file .env.dev up -d
|
||||
```
|
||||
|
||||
### Start Production Environment
|
||||
```bash
|
||||
cd /data/dev/bamort/docker
|
||||
|
||||
# Create .env file with your configuration
|
||||
cp .env.example .env
|
||||
# Edit .env with your settings
|
||||
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ services:
|
||||
- /app/node_modules # Prevent overwriting node_modules
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- VITE_API_URL=http://localhost:8080
|
||||
- VITE_API_URL=${VITE_API_URL:-http://192.168.0.48:8180}
|
||||
depends_on:
|
||||
- backend-dev
|
||||
restart: unless-stopped
|
||||
|
||||
@@ -43,6 +43,8 @@ services:
|
||||
container_name: frontend
|
||||
ports:
|
||||
- "5173:80"
|
||||
environment:
|
||||
- VITE_API_URL=${VITE_API_URL:-http://192.168.0.48:8180}
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import axios from 'axios'
|
||||
|
||||
const API = axios.create({
|
||||
baseURL: import.meta.env.VITE_API_URL || 'http://localhost:8180', // Use env variable with fallback
|
||||
//baseURL: 'http://192.168.0.48:8180', // Replace with your backend URL
|
||||
baseURL: 'http://localhost:8180', // Replace with your backend URL
|
||||
//baseURL: 'http://localhost:8180', // Replace with your backend URL
|
||||
})
|
||||
|
||||
// Request interceptor to add auth token
|
||||
|
||||
Reference in New Issue
Block a user