85 lines
3.1 KiB
Bash
85 lines
3.1 KiB
Bash
# Copy to .env for your LOCAL synthetic test environment; never commit .env.
|
||
# Values below are the variables this implementation actually reads
|
||
# (viper: section.name -> SECTION_NAME, see internal/config/config.go).
|
||
#
|
||
# Mapping to the logical names suggested by the skeleton:
|
||
# APP_HOST / APP_PORT -> SERVER_HOST / SERVER_PORT
|
||
# SESSION_STORE=postgres -> server-side sessions live in PostgreSQL (SESSION_TTL_SECONDS)
|
||
# DATABASE_URL_FILE -> unused: POSTGRES_* below pass no secret files
|
||
# CACHE_URL_FILE -> unused: REDIS_* below pass no secret files
|
||
# API_REPLICAS -> number of API replicas of the stand (compose.yaml)
|
||
#
|
||
# APP_ENV selects config/<env>/config.yaml; the implementation supports only `dev`.
|
||
APP_ENV=dev
|
||
|
||
SERVER_HOST=0.0.0.0
|
||
SERVER_PORT=8080
|
||
SERVER_READ_HEADER_TIMEOUT=10s
|
||
SERVER_SHUTDOWN_TIMEOUT=10s
|
||
# Предел размера тела запроса (байт): защищает реплику от чтения огромного тела
|
||
# до валидации. Для вложений LAB4 (до 10 MiB) значение нужно поднять.
|
||
SERVER_MAX_BODY_BYTES=262144
|
||
|
||
LOG_LEVEL=info
|
||
LOG_FORMAT=json
|
||
|
||
# Synthetic credentials for the local stand only; override in .env for anything else.
|
||
POSTGRES_HOST=localhost
|
||
POSTGRES_PORT=5432
|
||
POSTGRES_DATABASE=messenger
|
||
POSTGRES_USER=messenger
|
||
POSTGRES_PASSWORD=messenger
|
||
POSTGRES_SSL_MODE=disable
|
||
POSTGRES_MAX_CONNS=10
|
||
POSTGRES_MIN_CONNS=1
|
||
POSTGRES_MAX_CONN_LIFETIME=1h
|
||
POSTGRES_MAX_CONN_IDLE_TIME=30m
|
||
POSTGRES_CONNECT_TIMEOUT=5s
|
||
POSTGRES_QUERY_TIMEOUT=5s
|
||
|
||
REDIS_ENABLED=true
|
||
REDIS_HOST=localhost
|
||
REDIS_PORT=6379
|
||
REDIS_PASSWORD=
|
||
REDIS_DB=0
|
||
# -1 disables go-redis retries; 0 keeps the library default (3 retries).
|
||
REDIS_MAX_RETRIES=-1
|
||
REDIS_DIAL_TIMEOUT=300ms
|
||
REDIS_READ_TIMEOUT=200ms
|
||
REDIS_WRITE_TIMEOUT=200ms
|
||
REDIS_POOL_SIZE=10
|
||
|
||
CACHE_ENABLED=true
|
||
CACHE_CHAT_LIST_TTL=5m
|
||
CACHE_LOCK_TTL=10s
|
||
CACHE_LOCK_WAIT_TIMEOUT=2s
|
||
|
||
SESSION_TTL_SECONDS=3600
|
||
|
||
# Retention of a message Idempotency-Key in the shared store; contract 1.3.0
|
||
# requires at least 24 h.
|
||
IDEMPOTENCY_TTL_SECONDS=86400
|
||
|
||
# Lab3 stand (compose.yaml): number of API replicas behind the LB and per-replica
|
||
# CPU/RAM limits. Track 1 varies them to compare 1/2/4 replicas at a fixed total
|
||
# budget, e.g. API_REPLICAS=4 API_CPU_LIMIT=0.25 API_MEM_LIMIT=192M.
|
||
API_REPLICAS=2
|
||
API_CPU_LIMIT=0.50
|
||
API_MEM_LIMIT=256M
|
||
|
||
# Connections of ONE API replica to PostgreSQL; the total is replicas × value.
|
||
# Track 1 checks whether the shared connection budget becomes the saturation
|
||
# point: at 4 replicas the default 10 means 40 connections against one database.
|
||
POSTGRES_MAX_CONNS=10
|
||
|
||
# CPU quota of the shared database. Track 1 shows it is the stand's saturation
|
||
# point: the API uses a fraction of its budget while PostgreSQL sits at its own.
|
||
POSTGRES_CPU_LIMIT=0.50
|
||
|
||
# Memory quota of the shared database. The track 1 series r/g/pool were measured
|
||
# with 512M, the db1cpu control — with 384M (see evidence/track1/profile-*.json).
|
||
POSTGRES_MEM_LIMIT=384M
|
||
|
||
# Loopback port of the HAProxy operator page (UP/DOWN of every replica).
|
||
LB_STATS_PORT=8404
|