# ==============================================================================
# DOCKER ARCHITECTURE CONFIGURATION CONTROL PANEL (.env)
# ==============================================================================
# INTENTION: This file acts as the single source of truth for the entire local 
# infrastructure. By isolating variables here, we decouple environment state 
# from the core container orchestration logic (docker-compose.yml) and image 
# compilation (Dockerfile), allowing rapid upgrades (e.g., swapping Resin or DB 
# versions) without altering structural code.
# ==============================================================================

# ------------------------------------------------------------------------------
# 1. APPLICATION SERVER (RESIN) CONFIGURATION
# ------------------------------------------------------------------------------

# Root storage path inside the AP container for intra-mart system data.
# CRITICAL: This value must exactly match the 'root-path-name' declared in:
# webapps/imart/WEB-INF/conf/storage-config.xml
IM_STORAGE_ROOT=/ap-server/im-data/storage

# Outbound corporate proxy configurations.
# Fill these if your host machine operates behind a restricted enterprise network.
# Example: http://user:password@proxy.server.com:8080/
HTTP_PROXY=
HTTPS_PROXY=

# Host directory mapped for compilation context. 
# Points to the base directory where application source folders live.
RESIN_HOST_DIR=./ap

# DOCKER AUTOMATION CORE: Target Application Folder Name
# Changing this string forces the Dockerfile COPY command to target a new 
# directory (e.g., resin-pro-2027) while leaving old versions untouched.
RESIN_SERVER_NAME=resin-pro

# The target installation prefix and deployment home directory inside the container.
RESIN_HOME=/ap-server

# Port Mapping Strategy for Application Server
# GUEST: The inner listening port configured inside Resin config binaries.
# HOST: The outer exposed port mapped to your physical web browser.
RESIN_GUEST_PORT=8080
RESIN_HOST_PORT=8080

# Database Connectivity Driver Dependency
# Automates the external download and placement of the Postgres engine driver 
# into the runtime class path during the Docker image building phase.
JDBC_FILE_NAME=postgresql-42.7.7.jar
JDBC_DOWNLOAD_URL=https://jdbc.postgresql.org/download

# Resource Allocation: Maximum memory capacity throttle for the AP container.
AP_MEMORY_SIZE=6G

# Internal Java Runtime Environment Matrix
# Defines base JDK packages to pull from the AlmaLinux system repositories.
IM_JAVA_HOME=/usr/lib/jvm
CONTAINER_JDK=java-21-openjdk

# ------------------------------------------------------------------------------
# 2. DATABASE SERVER (POSTGRESQL) CONFIGURATION
# ------------------------------------------------------------------------------
# IMPORTANT ARCHITECTURE NOTE: For proper database connection pools, ensure that 
# your 'resin-web.xml' or context resource block sets the target JDBC URL string to:
# jdbc:postgresql://db:5432/iap_db (Using the internal docker network service mesh name)

# Resource Allocation: Maximum memory capacity throttle for the Postgres container.
DB_MEMORY_SIZE=2G

# Postgres operational engine credentials and target database mapping.
# These are automatically passed as environment hooks to seed the database instance.
DB_NAME=iap_db
DB_USER=imart
DB_PASSWORD=imart

# Database Port Mapping Strategy
# GUEST: Default internal PostgreSQL port.
# HOST: Port bound to host machine for external tooling access (e.g., DBeaver, Datagrip).
DB_GUEST_PORT=5432
DB_HOST_PORT=5432

# ------------------------------------------------------------------------------
# 3. DATABASE ADMINISTRATION UTILITY (ADMINER) CONFIGURATION
# ------------------------------------------------------------------------------
# Provides an isolated GUI console to inspect schemas and tables without 
# altering runtime application state.

# Adminer Utility Port Mapping Strategy
# HOST: Access this via http://localhost:8889 to open the database web console.
DBADM_GUEST_PORT=8080
DBADM_HOST_PORT=8889

# Resource Allocation: Maximum memory capacity throttle for the Adminer container.
ADMINER_MEMORY_SIZE=1G