Files
mtusi2026lab5-fork/src/main/resources/application.conf
T

139 lines
3.7 KiB
Plaintext

ktor {
application {
modules = [com.mtusi.messenger.main.AppKt.module]
}
deployment {
host = "0.0.0.0"
host = ${?APP_HOST}
port = 8080
port = ${?APP_PORT}
# After the drain (see `shutdown`): Netty waits for 1 s without new activity, at most 5 s in total.
shutdownGracePeriod = 1000
shutdownTimeout = 5000
}
}
shutdown {
# Time between SIGTERM and closing the socket while /health/ready is already 503.
# Behind HAProxy (check every 1 s, 2 failures) 3 s is enough to leave rotation; a single local process needs none.
drainDelayMs = 0
drainDelayMs = ${?SHUTDOWN_DRAIN_DELAY_MS}
}
database {
host = "localhost"
host = ${?DB_HOST}
port = 5432
port = ${?DB_PORT}
name = "messenger"
name = ${?DB_NAME}
username = "messenger"
username = ${?DB_USER}
password = ${?DB_PASSWORD}
passwordFile = ${?DB_PASSWORD_FILE}
maxPoolSize = 10
maxPoolSize = ${?DB_MAX_POOL_SIZE}
connectionTimeoutMs = 2000
statementTimeoutMs = 5000
# Replicas run with false: compose applies migrations once in the `migrate` service.
migrateOnStart = true
migrateOnStart = ${?DB_MIGRATE_ON_START}
}
redis {
host = "localhost"
host = ${?REDIS_HOST}
port = 6379
port = ${?REDIS_PORT}
password = ${?REDIS_PASSWORD}
passwordFile = ${?REDIS_PASSWORD_FILE}
connectTimeoutMs = 500
commandTimeoutMs = 500
}
cors {
# Defaults to false
#allowAnyHost = true
# Swagger UI sends "Try it out" to the contract server http://localhost:8080; pages opened elsewhere need these.
allowedHosts = [
{ host = "localhost:8080", schemes = ["http"] }
{ host = "localhost:8081", schemes = ["http"] }
{ host = "127.0.0.1:8080", schemes = ["http"] }
{ host = "127.0.0.1:8081", schemes = ["http"] }
]
# Defaults to true
#allowAnyMethod = true
#allowedMethods = [GET, POST, PATCH, PUT, DELETE, OPTIONS]
allowAnyHeader = true
#allowedHeaders = []
exposedHeaders = [X-Request-Id, X-Instance-Id, WWW-Authenticate]
# Browsers send Origin on same-origin POST too, e.g. Swagger UI served by the API itself.
allowSameOrigin = true
}
instance {
id = ${?INSTANCE_ID}
}
messages {
idempotencyTtlSeconds = 86400
idempotencyTtlSeconds = ${?IDEMPOTENCY_TTL_SECONDS}
}
authentication {
realm = "messenger"
sessionTtlSeconds = 3600
sessionTtlSeconds = ${?SESSION_TTL_SECONDS}
sessionCacheTtlSeconds = 60
# Collapse concurrent cache misses for one token into a single database lookup (track 1 compares on/off).
sessionCacheSingleFlight = true
sessionCacheSingleFlight = ${?SESSION_CACHE_SINGLE_FLIGHT}
# A logout answers 204 only after its tombstone is in Redis; it retries up to this long, then answers 503.
# Below HAProxy `timeout server` (10 s).
sessionRevokeTimeoutMs = 8000
sessionRevokeTimeoutMs = ${?SESSION_REVOKE_TIMEOUT_MS}
}
# S3 credentials are local files, never source-controlled values.
storage {
endpoint = "http://localhost:9000"
endpoint = ${?S3_ENDPOINT}
bucket = "messenger-attachments"
bucket = ${?S3_BUCKET}
accessKey = ${?S3_ACCESS_KEY_ID}
secretKey = ${?S3_SECRET_ACCESS_KEY}
accessKeyFile = ${?S3_ACCESS_KEY_ID_FILE}
secretKeyFile = ${?S3_SECRET_ACCESS_KEY_FILE}
}
broker {
host = "localhost"
host = ${?BROKER_HOST}
port = 5672
port = ${?BROKER_PORT}
username = "messenger"
username = ${?BROKER_USER}
password = ${?BROKER_PASSWORD}
passwordFile = ${?BROKER_PASSWORD_FILE}
queue = "attachment.process.v1"
queue = ${?BROKER_QUEUE}
connectionTimeoutMs = 3000
operationTimeoutMs = 8000
}
worker {
concurrency = 1
concurrency = ${?WORKER_CONCURRENCY}
maxAttempts = 5
maxAttempts = ${?JOB_MAX_ATTEMPTS}
timeoutSeconds = 60
timeoutSeconds = ${?JOB_TIMEOUT_SECONDS}
stagingRetentionSeconds = 86400
stagingRetentionSeconds = ${?STAGING_RETENTION_SECONDS}
}