-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.env
More file actions
158 lines (127 loc) · 6.12 KB
/
sample.env
File metadata and controls
158 lines (127 loc) · 6.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Accordion Chat MVP - Environment Configuration
# Copy this file to .env and customize as needed
# ============================================
# Port Configuration
# ============================================
# Backend service port exposed to host (default: 8080)
# This is the port you'll access from your host machine
BACKEND_PORT=8080
# Backend internal container port (default: 8080)
# This is the port Spring Boot listens on inside the container
# IMPORTANT: If you change this, update ACCORDION_BACKEND_URL and ACCORDION_BACKEND_WS_URL below
SERVER_PORT=8080
# Web application service port exposed to host (default: 3000)
# This is the port you'll access from your browser
WEBAPP_PORT=3000
# Web application internal container port (default: 3000)
# This is the port the webapp listens on inside the container
WEBAPP_SERVER_PORT=3000
# ============================================
# Backend Configuration
# ============================================
# Spring Application Name
SPRING_APPLICATION_NAME=accordion-chat
# ============================================
# Database Configuration (H2 File-Based)
# ============================================
# H2 Database URL - Using file-based storage for persistence
# Data will be stored in /app/data/chatdb which is mounted to a Docker volume
# Connection parameters explained:
# - file:/app/data/chatdb: Store database in file system at this path
# - MODE=MySQL: Use MySQL compatibility mode for better compatibility
# - DB_CLOSE_DELAY=-1: Keep the database open as long as the JVM is running
# - DB_CLOSE_ON_EXIT=FALSE: Don't close the database automatically on JVM shutdown
SPRING_DATASOURCE_URL=jdbc:h2:file:/app/data/chatdb;MODE=MySQL;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
# H2 Driver
SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.h2.Driver
# Database Credentials
SPRING_DATASOURCE_USERNAME=sa
SPRING_DATASOURCE_PASSWORD=
# JPA Configuration
SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.H2Dialect
# Note: 'update' is convenient for local development but can cause schema drift over time.
# For production or when using migrations (Flyway/Liquibase), use 'validate' instead.
# Options: create, create-drop, update, validate, none
SPRING_JPA_HIBERNATE_DDL_AUTO=update
SPRING_JPA_SHOW_SQL=false
# H2 Console (for debugging)
SPRING_H2_CONSOLE_ENABLED=true
SPRING_H2_CONSOLE_PATH=/h2-console
# ============================================
# Security & CORS Configuration
# ============================================
# CORS Allowed Origins
# Use * for development, specific domains for production
# Examples:
# - Single domain: http://localhost:3000
# - Multiple domains: http://localhost:3000,https://chat.example.com
APP_CORS_ALLOWED_ORIGINS=*
# ============================================
# Validation Configuration
# ============================================
# Maximum message content length (characters)
APP_MESSAGE_MAX_LENGTH=1000
# Username length constraints
APP_USERNAME_MAX_LENGTH=50
APP_USERNAME_MIN_LENGTH=3
# ============================================
# Web Application Configuration
# ============================================
# Web Application Name
WEBAPP_SPRING_APPLICATION_NAME=accordion-webapp
# Backend URLs for webapp SERVER to connect to (server-side, internal Docker network)
# These are used by the webapp server for server-to-server communication
# Use service name (backend) for Docker Compose
ACCORDION_BACKEND_URL=http://backend:8080
ACCORDION_BACKEND_WS_URL=http://backend:8080/ws
# Docker host IP for accessing services from browsers on other machines
# Use localhost for local-only access (default)
# Use your machine's IP address (e.g., 192.168.1.100) for network access
# Use 0.0.0.0 to bind to all interfaces (use with caution)
DOCKER_HOST_IP=localhost
# Backend URLs for BROWSER to connect to (client-side, must be accessible from browser)
# These are used by browser JavaScript to connect to the backend
# IMPORTANT: Must use localhost, DOCKER_HOST_IP, or your public domain - browsers cannot resolve Docker service names
# Uses DOCKER_HOST_IP variable by default for flexible network access
ACCORDION_BACKEND_CLIENT_URL=http://${DOCKER_HOST_IP}:8080
ACCORDION_BACKEND_CLIENT_WS_URL=http://${DOCKER_HOST_IP}:8080/ws
# For production with a public domain:
# DOCKER_HOST_IP=yourdomain.com
# ACCORDION_BACKEND_CLIENT_URL=https://${DOCKER_HOST_IP}
# ACCORDION_BACKEND_CLIENT_WS_URL=https://${DOCKER_HOST_IP}/ws
# For network access (accessing from other machines on your network):
# 1. Find your machine's IP: ip addr show (Linux) or ipconfig (Windows)
# 2. Set DOCKER_HOST_IP to your machine's IP (e.g., 192.168.1.100)
# Example:
# DOCKER_HOST_IP=192.168.1.100
# The URLs will automatically use your IP: http://192.168.1.100:8080
# For local development (when not using Docker Compose):
# DOCKER_HOST_IP=localhost
# ACCORDION_BACKEND_URL=http://localhost:8080
# ACCORDION_BACKEND_WS_URL=http://localhost:8080/ws
# ACCORDION_BACKEND_CLIENT_URL=http://localhost:8080
# ACCORDION_BACKEND_CLIENT_WS_URL=http://localhost:8080/ws
# If you changed SERVER_PORT or BACKEND_PORT above, update the client URLs:
# Example for BACKEND_PORT=9090 and SERVER_PORT=9090:
# ACCORDION_BACKEND_CLIENT_URL=http://${DOCKER_HOST_IP}:9090
# ACCORDION_BACKEND_CLIENT_WS_URL=http://${DOCKER_HOST_IP}:9090/ws
# ============================================
# Docker Configuration
# ============================================
# Container names (optional, defaults will be used if not set)
# BACKEND_CONTAINER_NAME=accordion-backend
# WEBAPP_CONTAINER_NAME=accordion-webapp
# ============================================
# Production Notes
# ============================================
# For production deployment:
# 1. Set APP_CORS_ALLOWED_ORIGINS to specific domains
# 2. Consider using PostgreSQL instead of H2:
# - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/accordion
# - SPRING_DATASOURCE_USERNAME=accordion_user
# - SPRING_DATASOURCE_PASSWORD=<secure_password>
# - SPRING_JPA_DATABASE_PLATFORM=org.hibernate.dialect.PostgreSQLDialect
# 3. Set SPRING_JPA_SHOW_SQL=false
# 4. Disable H2 Console: SPRING_H2_CONSOLE_ENABLED=false
# 5. Use environment-specific ports
# 6. Configure reverse proxy (nginx, traefik) for SSL/TLS