Files
grimmory/backend/src/main/resources/application.yaml
T

155 lines
7.9 KiB
YAML

app:
path-config: ${APP_PATH_CONFIG:/app/data}
bookdrop-folder: ${APP_BOOKDROP_FOLDER:/bookdrop}
api-docs:
enabled: ${API_DOCS_ENABLED:false}
cors:
# Comma-separated list of allowed CORS origins.
# Leave empty (default) to allow same-origin requests only.
# Example: ALLOWED_ORIGINS=https://app.example.com,https://mobile.example.com
allowed-origins: ${ALLOWED_ORIGINS:*}
remote-auth:
enabled: ${REMOTE_AUTH_ENABLED:false}
create-new-users: ${REMOTE_AUTH_CREATE_NEW_USERS:true}
header-name: ${REMOTE_AUTH_HEADER_NAME:Remote-Name}
header-user: ${REMOTE_AUTH_HEADER_USER:Remote-User}
header-email: ${REMOTE_AUTH_HEADER_EMAIL:Remote-Email}
header-groups: ${REMOTE_AUTH_HEADER_GROUPS:Remote-Groups}
admin-group: ${REMOTE_AUTH_ADMIN_GROUP}
groups-delimiter: ${REMOTE_AUTH_GROUPS_DELIMITER:\\s+}
disk-type: ${DISK_TYPE:LOCAL}
oidc:
force-disable: ${FORCE_DISABLE_OIDC:false}
allow-unsafe-hosts: ${OIDC_ALLOW_UNSAFE_HOSTS:false} # If enabled, turn off outbound SSRF filtering
outbound:
connect-timeout: 15
read-timeout: 15
restricted-ranges:
- "0.0.0.0/8" # "This host on this network" - RFC 6890 - https://datatracker.ietf.org/doc/html/rfc6890
- "10.0.0.0/8" # Private Network Prefix - RFC 1918 - https://datatracker.ietf.org/doc/html/rfc1918
- "100::/64" # IPv6 Discard Prefix - RFC 6666 - https://datatracker.ietf.org/doc/html/rfc6666
- "100.64.0.0/10" # Shared Address Space - RFC 6890 - https://datatracker.ietf.org/doc/html/rfc6890
- "::1/128" # IPv6 Loopback - RFC 4291 - https://datatracker.ietf.org/doc/html/rfc4291
- "127.0.0.0/8" # Loopback - RFC 6890 - https://datatracker.ietf.org/doc/html/rfc6890
- "::/128" # "Unspecified" - RFC 4291 - https://datatracker.ietf.org/doc/html/rfc4291
- "169.254.0.0/16" # Link Local - RFC 6890 - https://datatracker.ietf.org/doc/html/rfc6890
- "172.16.0.0/12" # Private Use - RFC 6890 - https://datatracker.ietf.org/doc/html/rfc6890
- "192.0.0.0/24" # IETF Protocol Assignments - RFC 6890 - https://datatracker.ietf.org/doc/html/rfc6890
- "192.0.0.0/29" # DS-Lite - RFC 6333 - https://datatracker.ietf.org/doc/html/rfc6333
- "192.0.2.0/24" # TEST-NET-1 - RFC 5737 - https://datatracker.ietf.org/doc/html/rfc5737
- "192.168.0.0/16" # Private Use - RFC 6890 - https://datatracker.ietf.org/doc/html/rfc6890
- "192.88.99.0/24" # An Anycast Prefix for 6to4 Relay Routers - RFC 3068 - https://datatracker.ietf.org/doc/html/rfc3068
- "198.18.0.0/15" # Network Interconnect Device Benchmark Testing - RFC 2544 - https://datatracker.ietf.org/doc/html/rfc2544
- "198.51.100.0/24" # TEST-NET-2 - RFC 5737 - https://datatracker.ietf.org/doc/html/rfc5737
- "2001:10::/28" # IPv6 ORCHID Prefix - RFC 7343 - https://datatracker.ietf.org/doc/html/rfc7343
- "2001::/23" # Initial IPv6 Sub-TLA ID Assignments - RFC 2928 - https://datatracker.ietf.org/doc/html/rfc2928
- "2001:0200::/48" # IPv6 Benchmarking Prefix - RFC 5180 - https://datatracker.ietf.org/doc/html/rfc5180
- "2001::/32" # IPv6 Global Teredo Prefix - RFC 4380 - https://datatracker.ietf.org/doc/html/rfc4380
- "2001:db8::/32" # IPv6 Documentation Prefix - RFC 3849 - https://datatracker.ietf.org/doc/html/rfc3849
- "2002::/16" # Connection of IPv6 Domains via IPv4 Clouds - RFC 3056 - https://datatracker.ietf.org/doc/html/rfc3056
- "203.0.113.0/24" # TEST-NET-3 - RFC 5737 - https://datatracker.ietf.org/doc/html/rfc5737
- "240.0.0.0/4" # Reserved - RFC 6890 - https://datatracker.ietf.org/doc/html/rfc6890
- "255.255.255.255/32" # Limited Broadcast - RFC 0919 - https://datatracker.ietf.org/doc/html/rfc0919
- "64:ff9b:1::/48" # Local-Use IPv4/IPv6 Translation Prefix - RFC 8215 - https://datatracker.ietf.org/doc/html/rfc8215
- "64:ff9b::/96" # IPv6 Addressing of IPv4/IPv6 Translators - RFC 6052 - https://datatracker.ietf.org/doc/html/rfc6052
- "fc00::/7" # Unique Local IPv6 Unicast Addresses - RFC 4193 - https://datatracker.ietf.org/doc/html/rfc4193
- "fe80::/10" # Link-Local unicast - RFC 4291 - https://datatracker.ietf.org/doc/html/rfc4291
server:
forward-headers-strategy: native
port: ${SERVER_PORT:${BOOKLORE_PORT:6060}}
compression:
enabled: true
mime-types: text/html,text/css,text/javascript,application/javascript,application/json,image/svg+xml,application/xml,application/atom+xml
min-response-size: 1024
tomcat:
relaxed-query-chars: '[,],%,{,},|'
threads:
max: 10 # Virtual threads handle concurrency; platform threads just overhead
min-spare: 2
max-http-request-header-size: 64KB
spring:
jackson:
deserialization:
fail-on-null-for-primitives: false
servlet:
multipart:
enabled: true
max-file-size: 1024MB
max-request-size: 1024MB
file-size-threshold: 0
mvc:
async:
request-timeout: 600000
application:
name: booklore-api
data:
web:
pageable:
max-page-size: 100
datasource:
url: ${DATABASE_URL:jdbc:mariadb://${DATABASE_HOST:${DB_HOST:mariadb}}:${DATABASE_PORT:3306}/${DATABASE_NAME:booklore}?createDatabaseIfNotExist=true&connectionTimeZone=UTC&forceConnectionTimeZoneToSession=true}
username: ${DATABASE_USERNAME:root}
password: ${DATABASE_PASSWORD:${MYSQL_ROOT_PASSWORD}}
hikari:
pool-name: BookloreHikariPool
auto-commit: false # Required counterpart to provider_disables_autocommit
max-lifetime: 580000 # 9.6 minutes (avoid DB-side connection cuts)
connection-timeout: 30000 # 30s to acquire a connection before timeout
maximum-pool-size: 5 # Virtual threads don't need large pools; 5 is enough for a self-hosted app
minimum-idle: 1 # Minimal warm connections; virtual threads handle bursts
idle-timeout: 300000 # 5 minutes before idle connections are closed
jpa:
open-in-view: false
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
show-sql: false
properties:
hibernate:
query:
timeout: 30 # 30s max for any HQL/JPQL query
plan_cache_max_size: 128 # Reduce from 2048 default; small self-hosted app
plan_parameter_metadata_max_size: 32 # Reduce from 128 default
in_clause_parameter_padding: true # Pad IN params to power-of-2; fewer unique plan cache entries
fail_on_pagination_over_collection_fetch: true # Fail fast when paginating over collection fetches (in-memory pagination)
jdbc:
time_zone: UTC
batch_size: 100
fetch_size: 50 # Reduce JDBC roundtrips for large result sets
order_inserts: true
order_updates: true
batch_versioned_data: true # Allow batching UPDATEs on @Version entities
connection:
provider_disables_autocommit: true # Skip unnecessary JDBC autocommit check; reduces roundtrips
default_batch_fetch_size: 16 # Global batch fetch for all lazy collections (prevents N+1)
log_slow_query: ${HIBERNATE_SLOW_QUERY_MS:500} # Log queries taking longer than 500ms (see org.hibernate.SQL_SLOW)
generate_statistics: ${HIBERNATE_STATISTICS:false}
threads:
virtual:
enabled: true
flyway:
enabled: true
locations: classpath:db/migration
springdoc:
api-docs:
enabled: ${app.api-docs.enabled:false}
path: /api/openapi.json
logging:
level:
root: ${ROOT_LOG_LEVEL:INFO}
org.booklore: ${LOG_LEVEL:INFO}
org.quartz.core.QuartzScheduler: WARN
org.quartz.simpl.SimpleThreadPool: WARN
org.quartz.simpl.RAMJobStore: WARN
org.hibernate.orm.connections.pooling: WARN
org.hibernate.session.metrics: ${HIBERNATE_METRICS_LOG_LEVEL:WARN}
org.springframework.security.config.annotation.authentication.configuration.InitializeUserDetailsBeanManagerConfigurer: ERROR