int commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package {{ .package }}.entrance.web;
|
||||
|
||||
import com.vs.sqlmapper.spring.DataSourceConfig;
|
||||
import com.vs.sqlmapper.spring.scan.VSDaoBeanScan;
|
||||
import com.vs.agent.TocoAgentInitializer;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
|
||||
@SpringBootApplication(scanBasePackages = {"{{.groupId}}", "com.vs"})
|
||||
@VSDaoBeanScan(basePackages = {"com.vs","{{.groupId}}"})
|
||||
@Import(DataSourceConfig.class)
|
||||
@MapperScan("{{.groupId}}.**.persist.mapper.mybatis")
|
||||
@EnableScheduling
|
||||
public class AppApplication{
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication application = new SpringApplication(AppApplication.class);
|
||||
application.addInitializers(new TocoAgentInitializer());
|
||||
application.run(args);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package {{ .package }}.entrance.web.config;
|
||||
|
||||
import org.apache.catalina.connector.Connector;
|
||||
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
|
||||
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@Configuration
|
||||
public class SSLConfig {
|
||||
|
||||
@Bean
|
||||
public ServletWebServerFactory servletContainer(Environment env) {
|
||||
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
|
||||
|
||||
// 禁用自动配置的SSL(如果存在)
|
||||
tomcat.setRegisterDefaultServlet(false);
|
||||
|
||||
if (hasSslConfig(env)) {
|
||||
tomcat.addAdditionalTomcatConnectors(createSslConnector(env));
|
||||
}
|
||||
|
||||
return tomcat;
|
||||
}
|
||||
|
||||
private boolean hasSslConfig(Environment env) {
|
||||
return env.containsProperty("ssl_certificate")
|
||||
&& env.containsProperty("ssl_certificate-private-key");
|
||||
}
|
||||
|
||||
private Connector createSslConnector(Environment env) {
|
||||
String certPath = env.getProperty("ssl_certificate");
|
||||
String keyPath = env.getProperty("ssl_certificate-private-key");
|
||||
String httpsPort = env.getProperty("server.https.port", "8443");
|
||||
|
||||
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
|
||||
connector.setScheme("https");
|
||||
connector.setSecure(true);
|
||||
connector.setPort(Integer.parseInt(httpsPort));
|
||||
|
||||
// 明确设置SSL配置
|
||||
connector.setProperty("SSLEnabled", "true");
|
||||
connector.setProperty("sslProtocol", "TLS");
|
||||
connector.setProperty("clientAuth", "false");
|
||||
connector.setProperty("sslEnabledProtocols", "TLSv1.2,TLSv1.3");
|
||||
|
||||
// 处理证书路径
|
||||
connector.setProperty("certificateFile", extractFilePath(certPath));
|
||||
connector.setProperty("certificateKeyFile", extractFilePath(keyPath));
|
||||
|
||||
return connector;
|
||||
}
|
||||
|
||||
private String extractFilePath(String classpathResource) {
|
||||
if (classpathResource == null) return null;
|
||||
|
||||
if (classpathResource.startsWith("classpath:")) {
|
||||
String resource = classpathResource.substring("classpath:".length());
|
||||
try {
|
||||
return new ClassPathResource(resource).getFile().getAbsolutePath();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to locate SSL certificate file", e);
|
||||
}
|
||||
}
|
||||
return classpathResource;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
server.port=8082
|
||||
|
||||
mock.enabled=true
|
||||
#datasource
|
||||
{{- if eq .dbType "oracle" }}
|
||||
spring.datasource.url=jdbc:oracle:thin:@//{{ .dbHost }}:{{ .dbPort }}/ORCLCDB
|
||||
{{- else if eq .dbType "postgresql" }}
|
||||
spring.datasource.url=jdbc:postgresql://{{ .dbHost }}:{{ .dbPort }}/{{ .dbDatabase }}?useUnicode=true&characterEncoding=utf8&autoReconnect=true&stringtype=unspecified
|
||||
{{- else if eq .dbType "mysql" }}
|
||||
spring.datasource.url=jdbc:mysql://${DB_HOST:10.0.2.201:3306}/${DB_DATABASE:hande_test}?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
{{- else if eq .dbType "dm"}}
|
||||
spring.datasource.url=jdbc:dm://${ .dbHost }/${ .dbPort }/SYSDBA?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
{{- end }}
|
||||
spring.datasource.username=${DB_USER:hande_test_user}
|
||||
spring.datasource.password=${DB_PASSWORD:Yu0FvhjUQDGdnmm5}
|
||||
spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource
|
||||
spring.datasource.tomcat.max-age=3600000
|
||||
@@ -0,0 +1,17 @@
|
||||
server.port=8080
|
||||
|
||||
#datasource
|
||||
{{- if eq .dbType "oracle" }}
|
||||
spring.datasource.url=jdbc:oracle:thin:@//{{ .dbHost }}:{{ .dbPort }}/ORCLCDB
|
||||
{{- else if eq .dbType "postgresql" }}
|
||||
spring.datasource.url=jdbc:postgresql://{{ .dbHost }}:{{ .dbPort }}/{{ .dbDatabase }}?useUnicode=true&characterEncoding=utf8&autoReconnect=true&stringtype=unspecified
|
||||
{{- else if eq .dbType "mysql" }}
|
||||
spring.datasource.url=jdbc:mysql://${DB_HOST:10.0.2.201:3306}/${DB_DATABASE:hande_test}?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
{{- else if eq .dbType "dm"}}
|
||||
spring.datasource.url=jdbc:dm://${ .dbHost }/${ .dbPort }/SYSDBA?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
{{- end }}
|
||||
spring.datasource.username=${DB_USER:hande_test_user}
|
||||
spring.datasource.password=${DB_PASSWORD:Yu0FvhjUQDGdnmm5}
|
||||
spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
server.port=8080
|
||||
|
||||
#datasource
|
||||
{{- if eq .dbType "oracle" }}
|
||||
spring.datasource.url=jdbc:oracle:thin:@//{{ .dbHost }}:{{ .dbPort }}/ORCLCDB
|
||||
{{- else if eq .dbType "postgresql" }}
|
||||
spring.datasource.url=jdbc:postgresql://{{ .dbHost }}:{{ .dbPort }}/{{ .dbDatabase }}?useUnicode=true&characterEncoding=utf8&autoReconnect=true&stringtype=unspecified
|
||||
{{- else if eq .dbType "mysql" }}
|
||||
spring.datasource.url=jdbc:mysql://${DB_HOST:10.0.2.201:3306}/${DB_DATABASE:hande_test}?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
{{- else if eq .dbType "dm"}}
|
||||
spring.datasource.url=jdbc:dm://${ .dbHost }/${ .dbPort }/SYSDBA?characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
{{- end }}
|
||||
spring.datasource.username=${DB_USER:hande_test_user}
|
||||
spring.datasource.password=${DB_PASSWORD:Yu0FvhjUQDGdnmm5}
|
||||
spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource
|
||||
@@ -0,0 +1,71 @@
|
||||
spring.profiles.active=local
|
||||
envs=local,remote,online,custom
|
||||
check=true
|
||||
spring.main.allow-bean-definition-overriding=true
|
||||
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
|
||||
spring.jpa.open-in-view=false
|
||||
spring.main.allow-circular-references=true
|
||||
spring.login.security.csrf=false
|
||||
application.name={{ .projectName }}
|
||||
mybatis.configuration.map-underscore-to-camel-case=true
|
||||
project_id={{ .projectId }}
|
||||
project_name={{ .projectName }}
|
||||
base.package={{.groupId}}
|
||||
{{- if eq .dbType "mysql" }}
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
{{- else if eq .dbType "postgresql" }}
|
||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||
vs.sqlmapper.dialect=postgresql
|
||||
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
|
||||
{{- else if eq .dbType "oracle" }}
|
||||
spring.datasource.driver-class-name=oracle.jdbc.OracleDriver
|
||||
hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
|
||||
vs.sqlmapper.dialect=oracle
|
||||
{{- else if eq .dbType "dm" }}
|
||||
spring.datasource.driver-class-name=dm.jdbc.driver.DmDriver
|
||||
hibernate.dialect=org.hibernate.dialect.DmDialect
|
||||
vs.sqlmapper.dialect=dm
|
||||
{{- end }}
|
||||
com.toco.agent.attach=false
|
||||
|
||||
#create default table
|
||||
vs.db.basetable.create=true
|
||||
server.ssl.enabled=false
|
||||
server.forward-headers-strategy=framework
|
||||
#request header
|
||||
out.request.headers=
|
||||
#response header
|
||||
out.response.headers=Content-Type
|
||||
#custom corss-domain headers, split by ','
|
||||
cross.domain.headers=
|
||||
#eg:https://vsstudio.teitui.com
|
||||
out.host=
|
||||
#hibernate.show_sql=true
|
||||
#vs.sqlmapper.showSql=true
|
||||
mock.enabled=false
|
||||
|
||||
## message config , use memory for test, mq.type can be redis/rocketmq/kafka
|
||||
mq.type=memory
|
||||
|
||||
#rocketmq.name-server=${ROCKETMQ_HOST:10.0.2.221:9876;10.0.2.222:9876;10.0.2.223:9876}
|
||||
|
||||
#redis
|
||||
#redis-config.pool.hostAndPort=${REDIS_HOST:redis.byteawake.com:6379}
|
||||
#redis-config.pool.password=${REDIS_PASSWORD:}
|
||||
#redis-config.pool.maxTotal=100
|
||||
#redis-config.pool.maxIdle=10
|
||||
#redis-config.pool.minIdle=10
|
||||
#redis-config.pool.maxWaitMillis=10000
|
||||
#redis-config.pool.softMinEvictableIdleTimeMillis=10000
|
||||
#redis-config.pool.testOnBorrow=true
|
||||
#redis-config.pool.testOnReturn=true
|
||||
#redis-config.pool.testWhileIdle=true
|
||||
#redis-config.pool.timeBetweenEvictionRunsMillis=30000
|
||||
#redis-config.pool.minEvictableIdleTimeMillis=1800000
|
||||
#redis-config.pool.numTestsPerEvictionRun=3
|
||||
#redis-config.pool.blockWhenExhausted=true
|
||||
#redis-config.pool.jmxEnabled=true
|
||||
#redis-config.pool.lifo=true
|
||||
|
||||
#kafka.bootstrap-servers=localhost:9092
|
||||
26
template/entrance/web/src/main/resources/visitor_agents.conf
Normal file
26
template/entrance/web/src/main/resources/visitor_agents.conf
Normal file
@@ -0,0 +1,26 @@
|
||||
[debug.server.host]
|
||||
// 这块,目前基本是写死这样的配置,不要修改
|
||||
vs.debug.host = http://vsstudio.teitui.com
|
||||
|
||||
[debug.proxy.custom]
|
||||
// 定义需要增强的classs,没有增加的class不记录堆栈
|
||||
// 一般明显不需要记录的class,配置成: class.name=false
|
||||
// 正则表述式支持,请注意书写
|
||||
// class.pattern = true 表示要增强记录堆栈的
|
||||
|
||||
// 自定义的增加的类
|
||||
|
||||
com.vs.entrance.controller.env.register.DebugEnvRegisterTask=false
|
||||
com.vs.common.util.rpc.pub.PublicInterfaceExecutor = true +[execute]
|
||||
com.vs.common.util.rpc.pub.PublicInterfaceFilter = true +[doFilter]
|
||||
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter=true
|
||||
|
||||
com.vs.sqlmapper.core.SqlManagerImpl = true +[sqlWatcher]
|
||||
com.vs.common.util.rpc.RpcMethodExecutor = true
|
||||
|
||||
[debug.proxy.service]
|
||||
// 默认支持serivce下面的所有类,放到最后一行
|
||||
|
||||
.*?\.service[\.\w_]+ = true -[set*, get*]
|
||||
.*?\.controller[\.\w_]+ = true -[set*, get*]
|
||||
.*?\.hibernate[\.\w_]+ = false
|
||||
Reference in New Issue
Block a user