mirror of https://github.com/ZhongFuCheng3y/austin
parent
9e493352ba
commit
02c64f4d82
@ -0,0 +1,72 @@
|
|||||||
|
package com.java3y.austin.support.config;
|
||||||
|
|
||||||
|
import com.java3y.austin.common.dto.account.WeChatOfficialAccount;
|
||||||
|
import com.java3y.austin.support.utils.WxServiceUtils;
|
||||||
|
import lombok.Data;
|
||||||
|
import me.chanjar.weixin.common.api.WxConsts;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpMessageRouter;
|
||||||
|
import me.chanjar.weixin.mp.api.WxMpService;
|
||||||
|
import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Profile;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用微信服务号作为登录的媒介
|
||||||
|
* (测试环境 && 开启了配置才使用)
|
||||||
|
*
|
||||||
|
* @author 3y
|
||||||
|
*/
|
||||||
|
@Profile("test")
|
||||||
|
@Configuration
|
||||||
|
@ConditionalOnProperty(name = "austin.login.officialAccount.enable", havingValue = "true")
|
||||||
|
@Data
|
||||||
|
public class WeChatLoginAccountConfig {
|
||||||
|
|
||||||
|
@Value("${austin.login.official.account.appId}")
|
||||||
|
private String appId;
|
||||||
|
@Value("${austin.login.official.account.secret}")
|
||||||
|
private String secret;
|
||||||
|
@Value("${austin.login.official.account.secret}")
|
||||||
|
private String token;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WxServiceUtils wxServiceUtils;
|
||||||
|
|
||||||
|
private WxMpService officialAccountLoginService;
|
||||||
|
private WxMpDefaultConfigImpl config;
|
||||||
|
private WxMpMessageRouter wxMpMessageRouter;
|
||||||
|
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
private void init() {
|
||||||
|
WeChatOfficialAccount account = WeChatOfficialAccount.builder().appId(appId).secret(secret).token(token).build();
|
||||||
|
officialAccountLoginService = wxServiceUtils.initOfficialAccountService(account);
|
||||||
|
initConfig();
|
||||||
|
initRouter();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化路由器
|
||||||
|
*/
|
||||||
|
private void initRouter() {
|
||||||
|
wxMpMessageRouter = new WxMpMessageRouter(officialAccountLoginService);
|
||||||
|
wxMpMessageRouter.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT).event(WxConsts.EventType.SUBSCRIBE).handler(null).end();
|
||||||
|
wxMpMessageRouter.rule().async(false).msgType(WxConsts.XmlMsgType.EVENT).event(WxConsts.EventType.UNSUBSCRIBE).handler(null).end();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化配置信息
|
||||||
|
*/
|
||||||
|
private void initConfig() {
|
||||||
|
config.setAppId(appId);
|
||||||
|
config.setToken(token);
|
||||||
|
config.setSecret(secret);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,152 +0,0 @@
|
|||||||
# TODO please replace 【must】 config value
|
|
||||||
# TODO please replace 【must】 config value
|
|
||||||
# TODO please replace 【must】 config value
|
|
||||||
server.port=8080
|
|
||||||
|
|
||||||
# todo [database] ip/port/username/password 【must】
|
|
||||||
austin.database.ip=austin-mysql
|
|
||||||
austin.database.port=3306
|
|
||||||
austin.database.username=root
|
|
||||||
austin.database.password=root123_A
|
|
||||||
|
|
||||||
# todo [redis] ip/port/password【must】
|
|
||||||
austin.redis.ip=austin-redis
|
|
||||||
austin.redis.port=6379
|
|
||||||
austin.redis.password=austin
|
|
||||||
|
|
||||||
# TODO choose : kafka/eventBus/rocketMq/rabbitMq, default eventBus
|
|
||||||
austin.mq.pipeline=eventBus
|
|
||||||
|
|
||||||
# todo [kafka] ip/port【optional】, if austin.mq.pipeline=kafka 【must】
|
|
||||||
austin.kafka.ip=austin.kafka
|
|
||||||
austin.kafka.port=9092
|
|
||||||
|
|
||||||
# todo [rocketMq] 【optional】, if austin.mq.pipeline=rocketMq【must】
|
|
||||||
austin.rocketmq.nameserver.ip=
|
|
||||||
austin.rocketmq.nameserver.port=
|
|
||||||
|
|
||||||
# todo [rabbitMq] 【optional】, if austin.mq.pipeline=rabbitMq【must】
|
|
||||||
austin.rabbitmq.ip=
|
|
||||||
austin.rabbitmq.port=
|
|
||||||
|
|
||||||
# todo [xxl-job] switch 【optional】, if austin.xxl.job.enabled=true 【must】
|
|
||||||
austin.xxl.job.enabled=false
|
|
||||||
austin.xxl.job.ip=127.0.0.1
|
|
||||||
austin.xxl.job.port=6767
|
|
||||||
|
|
||||||
# todo choose: apollo/nacos switch 【optional】 ,if apollo and nacos both false, use local.properties
|
|
||||||
austin.apollo.enabled=false
|
|
||||||
austin.nacos.enabled=false
|
|
||||||
|
|
||||||
# todo [grayLog] ip 【optional】
|
|
||||||
austin.grayLog.ip=austin.graylog
|
|
||||||
|
|
||||||
# TODO if windows os and need upload file to send message ,replace path !【optional】
|
|
||||||
austin.business.upload.crowd.path=/Users/3y/temp
|
|
||||||
|
|
||||||
########################################## database start ##########################################
|
|
||||||
# notice:mysql version 5.7x !!!
|
|
||||||
spring.datasource.url=jdbc:mysql://${austin.database.ip}:${austin.database.port}/austin?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull
|
|
||||||
spring.datasource.username=${austin.database.username}
|
|
||||||
spring.datasource.password=${austin.database.password}
|
|
||||||
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
|
||||||
########################################## database end ##########################################
|
|
||||||
|
|
||||||
########################################## kafka start ##########################################
|
|
||||||
spring.kafka.bootstrap-servers=${austin.kafka.ip}:${austin.kafka.port}
|
|
||||||
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
|
|
||||||
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
|
|
||||||
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
|
|
||||||
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
|
|
||||||
spring.kafka.consumer.auto.offset.reset=earliest
|
|
||||||
spring.kafka.consumer.auto-commit-interval=1000
|
|
||||||
spring.kafka.consumer.enable-auto-commit=true
|
|
||||||
|
|
||||||
###
|
|
||||||
austin.business.topic.name=austinBusiness
|
|
||||||
austin.business.recall.topic.name=austinRecall
|
|
||||||
austin.business.recall.group.name=recallGroupId
|
|
||||||
austin.business.log.topic.name=austinTraceLog
|
|
||||||
### TODO kafka tag filter,if you need, replace tagIdValue ,eg:com.java3y.austin.yyy
|
|
||||||
austin.business.tagId.key=kafka_tag_id
|
|
||||||
austin.business.tagId.value=com.java3y.austin.3y
|
|
||||||
########################################## kafka end ##########################################
|
|
||||||
|
|
||||||
|
|
||||||
########################################## rocketMq start ##########################################
|
|
||||||
rocketmq.name-server=${austin.rocketmq.nameserver.ip}:${austin.rocketmq.nameserver.port}
|
|
||||||
rocketmq.producer.group=unique-producer-group
|
|
||||||
austin.rocketmq.biz.consumer.group=unique-biz-consumer-group
|
|
||||||
austin.rocketmq.recall.consumer.group=unique-recall-consumer-group
|
|
||||||
########################################## rocketMq end ##########################################
|
|
||||||
|
|
||||||
|
|
||||||
########################################## RabbitMq start ##########################################
|
|
||||||
spring.rabbitmq.host=${austin.rabbitmq.ip}
|
|
||||||
spring.rabbitmq.port=${austin.rabbitmq.port}
|
|
||||||
spring.rabbitmq.username=root
|
|
||||||
spring.rabbitmq.password=123456
|
|
||||||
spring.rabbitmq.publisher-confirm-type=correlated
|
|
||||||
spring.rabbitmq.publisher-returns=true
|
|
||||||
spring.rabbitmq.virtual-host=/
|
|
||||||
austin.rabbitmq.topic.name=austinRabbit
|
|
||||||
austin.rabbitmq.exchange.name=austin.point
|
|
||||||
########################################## RabbitMq end ##########################################
|
|
||||||
|
|
||||||
########################################## redis start ##########################################
|
|
||||||
spring.redis.host=${austin.redis.ip}
|
|
||||||
spring.redis.port=${austin.redis.port}
|
|
||||||
spring.redis.password=${austin.redis.password}
|
|
||||||
########################################## redis end ##########################################
|
|
||||||
|
|
||||||
|
|
||||||
########################################## xxl start ##########################################
|
|
||||||
xxl.job.admin.addresses=http://${austin.xxl.job.ip}:${austin.xxl.job.port}/xxl-job-admin
|
|
||||||
xxl.job.admin.username=admin
|
|
||||||
xxl.job.admin.password=123456
|
|
||||||
xxl.job.executor.appname=austin
|
|
||||||
xxl.job.executor.jobHandlerName=austinJob
|
|
||||||
xxl.job.executor.ip=
|
|
||||||
xxl.job.executor.port=6666
|
|
||||||
xxl.job.executor.logpath=logs/xxl
|
|
||||||
xxl.job.executor.logretentiondays=30
|
|
||||||
xxl.job.accessToken=
|
|
||||||
########################################## xxl end ##########################################
|
|
||||||
|
|
||||||
########################################## apollo start ##########################################
|
|
||||||
app.id=austin
|
|
||||||
apollo.bootstrap.enabled=${austin.apollo.enabled}
|
|
||||||
apollo.bootstrap.namespaces=boss.austin,dynamic-tp-apollo-dtp.yml
|
|
||||||
########################################## apollo end ##########################################
|
|
||||||
|
|
||||||
########################################## nacos start ##########################################
|
|
||||||
austin.nacos.server=
|
|
||||||
austin.nacos.username=
|
|
||||||
austin.nacos.password=
|
|
||||||
austin.nacos.dataId=austin
|
|
||||||
austin.nacos.group=DEFAULT_GROUP
|
|
||||||
austin.nacos.namespace=9537c674-f3a6-4203-b286-ef0c36bfacb2
|
|
||||||
nacos.config.enabled=${austin.nacos.enabled}
|
|
||||||
########################################## nacos end ##########################################
|
|
||||||
|
|
||||||
########################################## httpUtils start ##########################################
|
|
||||||
ok.http.connect-timeout=30
|
|
||||||
ok.http.keep-alive-duration=300
|
|
||||||
ok.http.max-idle-connections=200
|
|
||||||
ok.http.read-timeout=30
|
|
||||||
ok.http.write-timeout=30
|
|
||||||
########################################## httpUtils end ##########################################
|
|
||||||
|
|
||||||
########################################## monitor start ##########################################
|
|
||||||
management.endpoint.health.show-details=always
|
|
||||||
management.endpoint.metrics.enabled=true
|
|
||||||
management.endpoint.prometheus.enabled=true
|
|
||||||
management.endpoints.web.exposure.include=*
|
|
||||||
management.metrics.export.prometheus.enabled=true
|
|
||||||
management.health.rabbit.enabled=false
|
|
||||||
########################################## monitor end ##########################################
|
|
||||||
|
|
||||||
########################################## system start ##########################################
|
|
||||||
server.shutdown=graceful
|
|
||||||
########################################## system end ##########################################
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
|||||||
|
# TODO please replace 【must】 config value
|
||||||
|
# TODO please replace 【must】 config value
|
||||||
|
# TODO please replace 【must】 config value
|
||||||
|
server.port=8080
|
||||||
|
|
||||||
|
# docker mysql
|
||||||
|
austin.database.ip=austin-mysql
|
||||||
|
austin.database.port=3306
|
||||||
|
austin.database.username=root
|
||||||
|
austin.database.password=root123_A
|
||||||
|
|
||||||
|
# docker redis
|
||||||
|
austin.redis.ip=austin-redis
|
||||||
|
austin.redis.port=6379
|
||||||
|
austin.redis.password=austin
|
||||||
|
|
||||||
|
# TODO choose : kafka/eventBus/rocketMq/rabbitMq, default eventBus
|
||||||
|
austin.mq.pipeline=eventBus
|
||||||
|
|
||||||
|
# todo [kafka] ip/port【optional】, if austin.mq.pipeline=kafka 【must】
|
||||||
|
austin.kafka.ip=austin.kafka
|
||||||
|
austin.kafka.port=9092
|
||||||
|
|
||||||
|
# todo [rocketMq] 【optional】, if austin.mq.pipeline=rocketMq【must】
|
||||||
|
austin.rocketmq.nameserver.ip=
|
||||||
|
austin.rocketmq.nameserver.port=
|
||||||
|
|
||||||
|
# todo [rabbitMq] 【optional】, if austin.mq.pipeline=rabbitMq【must】
|
||||||
|
austin.rabbitmq.ip=
|
||||||
|
austin.rabbitmq.port=
|
||||||
|
|
||||||
|
# todo [xxl-job] switch 【optional】, if austin.xxl.job.enabled=true 【must】
|
||||||
|
austin.xxl.job.enabled=false
|
||||||
|
austin.xxl.job.ip=127.0.0.1
|
||||||
|
austin.xxl.job.port=6767
|
||||||
|
|
||||||
|
# todo choose: apollo/nacos switch 【optional】 ,if apollo and nacos both false, use local.properties
|
||||||
|
austin.apollo.enabled=false
|
||||||
|
austin.nacos.enabled=false
|
||||||
|
|
||||||
|
# todo [grayLog] ip 【optional】
|
||||||
|
austin.grayLog.ip=austin.graylog
|
||||||
|
|
||||||
|
# TODO if windows os and need upload file to send message ,replace path !【optional】
|
||||||
|
austin.business.upload.crowd.path=/Users/3y/temp
|
||||||
|
|
||||||
|
# TODO if [login use officialAccount] switch 【optional】, if austin.login.officialAccount.enable=true 【must】
|
||||||
|
austin.login.official.account.enable=true
|
||||||
|
austin.login.official.account.appId=1
|
||||||
|
austin.login.official.account.secret=1
|
||||||
|
austin.login.official.account.token=1
|
@ -1,2 +1,108 @@
|
|||||||
spring.profiles.active=dev
|
spring.profiles.active=dev
|
||||||
spring.application.name=austin
|
spring.application.name=austin
|
||||||
|
|
||||||
|
########################################## database start ##########################################
|
||||||
|
# notice:mysql version 5.7x !!!
|
||||||
|
spring.datasource.url=jdbc:mysql://${austin.database.ip}:${austin.database.port}/austin?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull
|
||||||
|
spring.datasource.username=${austin.database.username}
|
||||||
|
spring.datasource.password=${austin.database.password}
|
||||||
|
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
|
||||||
|
########################################## database end ##########################################
|
||||||
|
|
||||||
|
########################################## kafka start ##########################################
|
||||||
|
spring.kafka.bootstrap-servers=${austin.kafka.ip}:${austin.kafka.port}
|
||||||
|
spring.kafka.producer.key-serializer=org.apache.kafka.common.serialization.StringSerializer
|
||||||
|
spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.StringSerializer
|
||||||
|
spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.StringDeserializer
|
||||||
|
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
|
||||||
|
spring.kafka.consumer.auto.offset.reset=earliest
|
||||||
|
spring.kafka.consumer.auto-commit-interval=1000
|
||||||
|
spring.kafka.consumer.enable-auto-commit=true
|
||||||
|
|
||||||
|
###
|
||||||
|
austin.business.topic.name=austinBusiness
|
||||||
|
austin.business.recall.topic.name=austinRecall
|
||||||
|
austin.business.recall.group.name=recallGroupId
|
||||||
|
austin.business.log.topic.name=austinTraceLog
|
||||||
|
### TODO kafka tag filter,if you need, replace tagIdValue ,eg:com.java3y.austin.yyy
|
||||||
|
austin.business.tagId.key=kafka_tag_id
|
||||||
|
austin.business.tagId.value=com.java3y.austin.3y
|
||||||
|
########################################## kafka end ##########################################
|
||||||
|
|
||||||
|
|
||||||
|
########################################## rocketMq start ##########################################
|
||||||
|
rocketmq.name-server=${austin.rocketmq.nameserver.ip}:${austin.rocketmq.nameserver.port}
|
||||||
|
rocketmq.producer.group=unique-producer-group
|
||||||
|
austin.rocketmq.biz.consumer.group=unique-biz-consumer-group
|
||||||
|
austin.rocketmq.recall.consumer.group=unique-recall-consumer-group
|
||||||
|
########################################## rocketMq end ##########################################
|
||||||
|
|
||||||
|
|
||||||
|
########################################## RabbitMq start ##########################################
|
||||||
|
spring.rabbitmq.host=${austin.rabbitmq.ip}
|
||||||
|
spring.rabbitmq.port=${austin.rabbitmq.port}
|
||||||
|
spring.rabbitmq.username=root
|
||||||
|
spring.rabbitmq.password=123456
|
||||||
|
spring.rabbitmq.publisher-confirm-type=correlated
|
||||||
|
spring.rabbitmq.publisher-returns=true
|
||||||
|
spring.rabbitmq.virtual-host=/
|
||||||
|
austin.rabbitmq.topic.name=austinRabbit
|
||||||
|
austin.rabbitmq.exchange.name=austin.point
|
||||||
|
########################################## RabbitMq end ##########################################
|
||||||
|
|
||||||
|
########################################## redis start ##########################################
|
||||||
|
spring.redis.host=${austin.redis.ip}
|
||||||
|
spring.redis.port=${austin.redis.port}
|
||||||
|
spring.redis.password=${austin.redis.password}
|
||||||
|
########################################## redis end ##########################################
|
||||||
|
|
||||||
|
|
||||||
|
########################################## xxl start ##########################################
|
||||||
|
xxl.job.admin.addresses=http://${austin.xxl.job.ip}:${austin.xxl.job.port}/xxl-job-admin
|
||||||
|
xxl.job.admin.username=admin
|
||||||
|
xxl.job.admin.password=123456
|
||||||
|
xxl.job.executor.appname=austin
|
||||||
|
xxl.job.executor.jobHandlerName=austinJob
|
||||||
|
xxl.job.executor.ip=
|
||||||
|
xxl.job.executor.port=6666
|
||||||
|
xxl.job.executor.logpath=logs/xxl
|
||||||
|
xxl.job.executor.logretentiondays=30
|
||||||
|
xxl.job.accessToken=
|
||||||
|
########################################## xxl end ##########################################
|
||||||
|
|
||||||
|
########################################## apollo start ##########################################
|
||||||
|
app.id=austin
|
||||||
|
apollo.bootstrap.enabled=${austin.apollo.enabled}
|
||||||
|
apollo.bootstrap.namespaces=boss.austin,dynamic-tp-apollo-dtp.yml
|
||||||
|
########################################## apollo end ##########################################
|
||||||
|
|
||||||
|
########################################## nacos start ##########################################
|
||||||
|
austin.nacos.server=
|
||||||
|
austin.nacos.username=
|
||||||
|
austin.nacos.password=
|
||||||
|
austin.nacos.dataId=austin
|
||||||
|
austin.nacos.group=DEFAULT_GROUP
|
||||||
|
austin.nacos.namespace=9537c674-f3a6-4203-b286-ef0c36bfacb2
|
||||||
|
nacos.config.enabled=${austin.nacos.enabled}
|
||||||
|
########################################## nacos end ##########################################
|
||||||
|
|
||||||
|
########################################## httpUtils start ##########################################
|
||||||
|
ok.http.connect-timeout=30
|
||||||
|
ok.http.keep-alive-duration=300
|
||||||
|
ok.http.max-idle-connections=200
|
||||||
|
ok.http.read-timeout=30
|
||||||
|
ok.http.write-timeout=30
|
||||||
|
########################################## httpUtils end ##########################################
|
||||||
|
|
||||||
|
########################################## monitor start ##########################################
|
||||||
|
management.endpoint.health.show-details=always
|
||||||
|
management.endpoint.metrics.enabled=true
|
||||||
|
management.endpoint.prometheus.enabled=true
|
||||||
|
management.endpoints.web.exposure.include=*
|
||||||
|
management.metrics.export.prometheus.enabled=true
|
||||||
|
management.health.rabbit.enabled=false
|
||||||
|
########################################## monitor end ##########################################
|
||||||
|
|
||||||
|
########################################## system start ##########################################
|
||||||
|
server.shutdown=graceful
|
||||||
|
########################################## system end ##########################################
|
||||||
|
Loading…
Reference in new issue