Files
mtusi2026lab3/src/main/resources/application.conf
T

97 lines
2.5 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}
}