novel/src/main/resources/application.yml
2022-09-01 09:50:36 +08:00

245 lines
6.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#--------------------------通用配置-------------------------
spring:
application:
# 应用名
name: novel
profiles:
# 激活特定配置
active: dev
jackson:
generator:
# JSON 序列化时,将所有 Number 类型的属性都转为 String 类型返回,避免前端数据精度丢失的问题。
# 由于 Javascript 标准规定所有数字处理都应使用 64 位 IEEE 754 浮点值完成,
# 结果是某些 64 位整数值无法准确表示(尾数只有 51 位宽)
write-numbers-as-strings: true
servlet:
multipart:
# 上传文件最大大小
max-file-size: 5MB
server:
# 端口号
port: 8888
--- #---------------------数据库配置---------------------------
spring:
datasource:
url: jdbc:mysql://localhost:3306/novel_test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: test123456
# ShardingSphere-JDBC 配置
# 配置是 ShardingSphere-JDBC 中唯一与应用开发者交互的模块,
# 通过它可以快速清晰的理解 ShardingSphere-JDBC 所提供的功能。
shardingsphere:
# 是否开启分库分表
enabled: false
props:
# 是否在日志中打印 SQL
sql-show: true
# 模式配置
mode:
# 单机模式
type: Standalone
repository:
# 文件持久化
type: File
props:
# 元数据存储路径
path: .shardingsphere
# 使用本地配置覆盖持久化配置
overwrite: true
# 数据源配置
datasource:
names: ds_0
ds_0:
type: com.zaxxer.hikari.HikariDataSource
driverClassName: com.mysql.cj.jdbc.Driver
jdbcUrl: jdbc:mysql://localhost:3306/novel_test?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: test123456
# 规则配置
rules:
# 数据分片
sharding:
tables:
# book_content 表
book_content:
# 数据节点
actual-data-nodes: ds_$->{0}.book_content$->{0..9}
# 分表策略
table-strategy:
standard:
# 分片列名称
sharding-column: chapter_id
# 分片算法名称
sharding-algorithm-name: bookContentSharding
sharding-algorithms:
bookContentSharding:
# 行表达式分片算法,使用 Groovy 的表达式,提供对 SQL 语句中的 = 和 IN 的分片操作支持
type: INLINE
props:
# 分片算法的行表达式
algorithm-expression: book_content$->{chapter_id % 10}
--- #---------------------中间件配置---------------------------
spring:
data:
# Redis 配置
redis:
host: 127.0.0.1
port: 6379
password: 123456
# Elasticsearch 配置
elasticsearch:
# 是否开启 Elasticsearch 搜索引擎功能true-开启 false-不开启
enabled: false
uris:
- https://my-deployment-ce7ca3.es.us-central1.gcp.cloud.es.io:9243
username: elastic
password: qTjgYVKSuExX6tWAsDuvuvwl
# Spring AMQP 配置
amqp:
# 是否开启 Spring AMQPtrue-开启 false-不开启
enabled: false
# RabbitMQ 配置
rabbitmq:
addresses: "amqp://guest:guest@47.106.243.172"
virtual-host: novel
template:
retry:
# 开启重试
enabled: true
# 最大重试次数
max-attempts: 3
# 第一次和第二次重试之间的持续时间
initial-interval: "3s"
# XXL-JOB 配置
xxl:
job:
# 是否开启 XXL-JOBtrue-开启 false-不开启
enabled: false
admin:
### 调度中心部署根地址 [选填]:如调度中心集群部署存在多个地址则用逗号分隔。执行器将会使用该地址进行"执行器心跳注册"和"任务结果回调";为空则关闭自动注册;
addresses: http://127.0.0.1:8080/xxl-job-admin
executor:
### 执行器AppName [选填]:执行器心跳注册分组依据;为空则关闭自动注册
appname: xxl-job-executor-novel
### 执行器运行日志文件存储磁盘路径 [选填] :需要对该路径拥有读写权限;为空则使用默认路径;
logpath: logs/xxl-job/jobhandler
### xxl-job, access token
accessToken: 123
--- #----------------------安全配置----------------------------
spring:
# Spring Boot 应用管理和监控
boot:
admin:
client:
# 是否开启 Spring Boot Admin 客户端
enabled: false
# Spring Boot Admin 服务端注册地址
url: http://localhost:8080
# Spring Boot Admin 服务端认证用户名
username: novel
# Spring Boot Admin 服务端认证密码
password: novel
instance:
metadata:
# SBA Client
user.name: ${spring.security.user.name}
user.password: ${spring.security.user.password}
security:
user:
name: ENDPOINT_ADMIN
password: ENDPOINT_ADMIN
roles: ENDPOINT_ADMIN
# Actuator 端点管理
management:
# 端点公开配置
endpoints:
# 通过 HTTP 公开的 Web 端点
web:
exposure:
# 公开所有的 Web 端点
include: "*"
# 端点启用配置
endpoint:
logfile:
# 启用返回日志文件内容的端点
enabled: true
# 外部日志文件路径
external-file: logs/novel.log
info:
env:
# 公开所有以 info. 开头的环境属性
enabled: true
health:
rabbit:
# 关闭 rabbitmq 的健康检查
enabled: false
elasticsearch:
# 关闭 elasticsearch 的健康检查
enabled: false
--- #--------------------接口文档配置---------------------------
springdoc:
api-docs:
enabled: false
--- #---------------------自定义配置----------------------------
novel:
# 跨域配置
cors:
# 允许跨域的域名
allow-origins:
- http://localhost:1024
- http://localhost:8080
# JWT密钥
jwt:
secret: E66559580A1ADF48CDD928516062F12E
# XSS 过滤配置
xss:
# 过滤开关
enabled: true
# 排除链接
excludes:
- /system/notice/*
file:
# 文件上传配置
upload:
# 上传路径
path: /Users/xiongxiaoyang/upload
--- #------------------- dev 特定配置---------------------------
spring:
config:
activate:
on-profile: dev
springdoc:
api-docs:
enabled: true
--- #------------------- test 特定配置--------------------------
spring:
config:
activate:
on-profile: test
--- #-------------------- prod 特定配置-------------------------
spring:
config:
activate:
on-profile: prod
data:
# Redis 配置
redis:
host: 127.0.0.1
port: 6379
password: