docs(config): document prod config options

- Add comments to datasource, redis, cookie and webhook sections
- Polish existing CORS and springdoc comments
- Enable secure cookie to satisfy same-site none
- Fix token secret and GitHub username typos
This commit is contained in:
zihluwang committed 2026-08-11 12:07:18 +08:00
1 parent 0a7882c5ce
commit 17b919705e
1 file changed
+65 -23
+65 -23
View File
@@ -1,48 +1,81 @@
spring: spring:
datasource: datasource:
# PostgreSQL connection URL.
url: jdbc:postgresql://localhost:5432/dfguide_dev url: jdbc:postgresql://localhost:5432/dfguide_dev
# PostgreSQL username.
username: postgres username: postgres
# PostgreSQL password.
password: 123456 password: 123456
# PostgreSQL JDBC driver class name.
driver-class-name: org.postgresql.Driver driver-class-name: org.postgresql.Driver
data: data:
redis: redis:
# Redis server host.
host: localhost host: localhost
# Redis server port.
port: 6379 port: 6379
# Redis database index.
#
# Default to 0.
database: 0 database: 0
# password: qwerty # Uncomment if password is necessary
# Redis server password.
#
# Uncomment if the server requires a password.
#
# password: qwerty
logging: logging:
pattern: pattern:
# dateformat: dd MMM yyyy HH:mm:ss.SSS # Modify this for custom date format. # Date format used in log output. Uncomment to use a custom format.
#
# Default to the date format provided by Spring Boot.
# dateformat: dd MMM yyyy HH:mm:ss.SSS
app: app:
cookie: cookie:
# Whether the cookie is accessible from JavaScript. Keep `true` to mitigate XSS attacks.
http-only: true http-only: true
secure: false
# Whether the cookie is only sent over HTTPS. Set to `true` in production is recommended.
secure: true
# SameSite policy of the cookie.
#
# NOTE that `none` requires `secure` to be `true`.
same-site: none same-site: none
# Cookie path.
path: '/' path: '/'
# Cookie max age.
max-age: P1D max-age: P1D
cors: cors:
# Cross-origin allowed origins # Cross-origin allowed origins. Add your custom origins here.
allowed-origins: allowed-origins: []
- "http://localhost:5173" # Dev server for vite.
- "http://localhost:4173" # Preview server for vite.
# Must be set to `true` since we are using cookie. You can change it only when you have # Whether to allow credentials (cookies, authorisation headers) in cross-origin requests.
# modified how this application executing authentication. #
# Must be `true` since the application uses cookies for authentication. Change it only when
# the authentication mechanism no longer relies on cookies.
allow-credentials: true allow-credentials: true
# Whether allow private network addresses. # Whether to allow requests originating from private network addresses.
allow-private-network: false allow-private-network: false
# Allowed headers. # Headers allowed in cross-origin requests.
allowed-headers: allowed-headers:
- "Content-Type" - "Content-Type"
- "Authorization" - "Authorization"
# Allowed methods. # HTTP methods allowed in cross-origin requests.
# #
# Since the usage of HttpMethod from Spring Framework, all methods should be UPPER CASE. # Methods are matched against Spring's HttpMethod, so they must be written in UPPER CASE.
# e.g., GET, POST, PUT, PATCH, DELETE, OPTIONS # e.g., GET, POST, PUT, PATCH, DELETE, OPTIONS
allowed-methods: allowed-methods:
- GET - GET
@@ -51,18 +84,20 @@ app:
- PATCH - PATCH
- DELETE - DELETE
# Headers are allowed being displayed on Web pages. # Response headers exposed to the browser in cross-origin responses.
exposed-headers: exposed-headers:
- "Content-Type" - "Content-Type"
- "Authorization" - "Authorization"
# Cross-origin policy max age. # How long the CORS pre-flight response may be cached by the browser.
#
# Default to PT2H (2 hours).
max-age: PT2H max-age: PT2H
jwt: jwt:
# Issuer host # Issuer identifier, domain name is recommended.
issuer: dfguide.local issuer: dfguide.local
# Token singing secret, a 32-byte long or longer string is recommended # Token signing secret, a 32-byte long or longer string is recommended.
secret: qwertyuiopasdfghjklzxcvbnm123456 secret: qwertyuiopasdfghjklzxcvbnm123456
# Token valid duration. # Token valid duration.
@@ -70,20 +105,27 @@ app:
# Default to PT2H (2 hours). # Default to PT2H (2 hours).
valid-time: PT2H valid-time: PT2H
# Token renew threshold. If valid time of this token is less than this value, then a new token # Token renew threshold.
# will be delivered to the user. #
# If valid time of this token is less than this value, then a new token will be delivered to
# the user.
# #
# Default to PT5M (5 min). # Default to PT5M (5 min).
renew-threshold: PT5M renew-threshold: PT5M
webhook: webhook:
github: github:
# GitHub webhook secret. Used to verify the signature of incoming webhook requests.
secret: 123456 secret: 123456
allowed-users: [ octotcat, onixbyte ]
# GitHub usernames allowed to trigger webhook events.
allowed-users: [ octocat, onixbyte ]
springdoc: springdoc:
api-docs: api-docs:
# Set to `false` if you do not need api docs (recommended in production mode). # Whether to expose the OpenAPI documentation. Set to `false` if you do not need it
# (recommended in production mode).
enabled: true enabled: true
swagger-ui: swagger-ui:
# Set to `false` if you do not need swagger ui (recommended in production mode). # Whether to expose the Swagger UI. Set to `false` if you do not need it
enabled: true # (recommended in production mode).
enabled: true