vincent пре 3 година
родитељ
комит
3ed4285aa0

+ 196 - 6
server/src/main/resources/application.yml

@@ -31,11 +31,201 @@ spring:
       max-request-size: 1024MB
       max-file-size: 1024MB
       enabled: true
+  mvc:
+    async:
+      request-timeout: 30s
+  rest:
+    proxy-host:
+    proxy-port:
+    proxy-ignore:
 
-  config:
-    location: classpath:/
-    additional-location: file:${DAVINCI3_HOME}/config/
-    name: application
+    ## davinci datasource config
+  datasource:
+    type: com.alibaba.druid.pool.DruidDataSource
+    url: jdbc:mysql://${DATABASE_HOST:61.132.52.38}:${DATABASE_PORT:20002}/${DATABASE_NAME:davinci0.3}?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
+    username: ${DATABASE_USER:root}
+    password: ${DATABASE_PWD:root}
+    driver-class-name: com.mysql.jdbc.Driver
+    initial-size: 1
+    min-idle: 1
+    max-wait: 30000
+    max-active: 10
+    break-after-acquire-failure: false
+    connection-error-retry-attempts: 1
+    time-between-eviction-runs-millis: 2000
+    min-evictable-idle-time-millis: 600000
+    max-evictable-idle-time-millis: 900000
+    time-between-connect-error-millis: 60000
+    test-while-idle: true
+    test-on-borrow: false
+    test-on-return: false
+    validation-query: select 1
+    validation-query-timeout: 10
+    keep-alive: false
+    filters: stat
+
+    ## redis config
+    ## please choose either of the two ways
+  redis:
+    isEnable: true
+
+      ## standalone config
+    host: 127.0.0.1
+    port: 6379
+
+      ## cluster config
+      #  cluster:
+      #       nodes:
+
+    password:
+    database: 0
+    timeout: 1000
+    jedis:
+      pool:
+        max-active: 8
+        max-wait: 1000
+        max-idle: 200
+        min-idle: 0
+
+    ## mail is one of the important configuration of the application
+    ## mail config cannot be null or empty
+    ## some mailboxes need to be set separately password for the SMTP service)
+  mail:
+    host: smtp.qq.com
+    port: 465
+    username: 372237882@qq.com
+    fromAddress: 372237882@qq.com
+    password: pdjjxdplzwwzbhic
+    nickname: vincent
+
+    properties:
+      smtp:
+        starttls:
+          enable: true
+          required: true
+        auth: true
+      mail:
+        smtp:
+          ssl:
+            enable: false
+
+  ldap:
+    urls:
+    username:
+    password:
+    base:
+    domainName:    # domainName 指 企业邮箱后缀,如企业邮箱为:xxx@example.com,这里值为 '@example.com'
+
+  security:
+    oauth2:
+      enable: false
+  #      client:
+  #        registration:
+  #          cas:
+  #            provider: cas
+  #            client-id: "xxxxx"
+  #            client-name: "Sign in with XXX"
+  #            client-secret: "xxxxx"
+  #            authorization-grant-type: authorization_code
+  #            client-authentication-method: post
+  #            redirect-uri-template: "{baseUrl}/login/oauth2/code/{registrationId}"
+  #            scope: userinfo
+  #        provider:
+  #          cas:
+  #            authorization-uri: https://cas.xxxxx.cn/cas/oauth2.0/authorize
+  #            token-uri: https://cas.xxxxx.cn/cas/oauth2.0/accessToken
+  #            user-info-uri: https://cas.xxxxx.cn/cas/oauth2.0/profile
+  #            user-name-attribute: id
+  #            userMapping:
+  #              email: "attributes.Email"
+  #              name: "attributes.CnName1"
+  #              avatar: "attributes.Avatar"
+#  config:
+#    location: classpath:/
+#    additional-location: file:config
+#    name: application-ext
+server:
+  protocol: http
+  address: 127.0.0.1
+  port: ${SERVER_PORT:8081}
+
+  servlet:
+    context-path: /
+
+  # Used for mail and download services, can be empty, careful configuration
+  # By default, 'server.address' and 'server.port' is used as the string value.
+  # access:
+  #  address:
+  #  port:
+
+
+## jwt is one of the important configuration of the application
+## jwt config cannot be null or empty
+jwtToken:
+  secret: secret
+  timeout: 1800000
+  algorithm: HS512
+
+## your datasource config
+source:
+  initial-size: 1
+  min-idle: 1
+  max-wait: 30000
+  max-active: 10
+  break-after-acquire-failure: false
+  connection-error-retry-attempts: 1
+  time-between-eviction-runs-millis: 2000
+  min-evictable-idle-time-millis: 600000
+  max-evictable-idle-time-millis: 900000
+  time-between-connect-error-millis: 60000
+  test-while-idle: true
+  test-on-borrow: false
+  test-on-return: false
+  validation-query: select 1
+  validation-query-timeout: 10
+  keep-alive: false
+  filters: stat
+
+  enable-query-log: false
+  result-limit: 1000000
+
+
+
+screenshot:
+  default_browser: CHROME
+  timeout_second: 600
+  chromedriver_path: $your_chromedriver_path$
+  remote_webdriver_url: $your_remote_webdriver_url$
+
+data-auth-center:
+  channels:
+    - name:
+      base-url:
+      auth-code:
+
+statistic:
+  enable: false
+
+  # You can use external elasticsearch storage [127.0.0.1:9300]
+  elastic_urls:
+  elastic_user:
+  elastic_index_prefix:
+
+  # You can also use external mysql storage
+  mysql_url:
+  mysql_username:
+  mysql_password:
+
+  # You can also use external kafka
+  kafka.bootstrap.servers:
+  kafka.topic:
+  java.security.krb5.conf:
+  java.security.keytab:
+  java.security.principal:
+
+encryption:
+  maxEncryptSize: 1024
+  type: Off # Off is to turn off encryption, to enable encryption, please select AES or RSA
 
   resources:
     static-locations: classpath:/META-INF/resources/, classpath:/resources/, classpath:/static/, file:${file.userfiles-path}, file:${file.web_resources}
@@ -58,7 +248,7 @@ spring:
 
 
 logging:
-  config: file:${DAVINCI3_HOME}/config/logback.xml
+  config: config/logback.xml
 
 ## nacos 配置
 nacos:
@@ -100,4 +290,4 @@ mapper:
 sql-template-delimiter: $
 
 
-custom-datasource-driver-path: ${DAVINCI3_HOME}/config/datasource_driver.yml
+custom-datasource-driver-path: classpath:/config/datasource_driver.yml

+ 0 - 0
config/application.yml → server/src/main/resources/config/application-ext.yml


+ 0 - 0
config/datasource_driver.yml → server/src/main/resources/config/datasource_driver.yml


+ 136 - 0
server/src/main/resources/config/logback.xml

@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ <<
+  ~  Davinci
+  ~  ==
+  ~  Copyright (C) 2016 - 2019 EDP
+  ~  ==
+  ~  Licensed under the Apache License, Version 2.0 (the "License");
+  ~  you may not use this file except in compliance with the License.
+  ~  You may obtain a copy of the License at
+  ~        http://www.apache.org/licenses/LICENSE-2.0
+  ~   Unless required by applicable law or agreed to in writing, software
+  ~   distributed under the License is distributed on an "AS IS" BASIS,
+  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~   See the License for the specific language governing permissions and
+  ~   limitations under the License.
+  ~  >>
+  ~
+  -->
+
+<configuration scan="true" scanPeriod="60 seconds">
+
+    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
+    <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
+
+    <property name="APP_NAME" value="davinci"/>
+
+    <property name="SYS" value="sys"/>
+    <property name="USER" value="user"/>
+
+    <property name="SQL" value="sql"/>
+    <property name="SCHEDULE" value="schedule"/>
+    <property name="OPT" value="opt"/>
+    <property name="DOWNLOAD" value="download"/>
+
+    <property name="LOG_HOME_PATH" value="${DAVINCI3_HOME}/logs"/>
+
+    <property name="SYS_LOG_PATTERN"
+              value="${FILE_LOG_PATTERN:-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } --- [%t] %-40.40logger{39} : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
+
+    <property name="BUSINESS_SQL_LOG_PATTERN"
+              value="${BUSINESS_SQL_LOG_PATTERN:-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} --- %file:%line : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
+
+    <property name="BUSINESS_OPERATION_LOG_PATTERN"
+              value="${BUSINESS_OPERATION_LOG_PATTERN:-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} --- %file:%line : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
+
+    <property name="BUSINESS_SCHEDULE_LOG_PATTERN"
+              value="${BUSINESS_SCHEDULE_LOG_PATTERN:-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} --- %file:%line : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
+
+    <property name="BUSINESS_DOWNLOAD_LOG_PATTERN"
+              value="${BUSINESS_DOWNLOAD_LOG_PATTERN:-%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} --- %file:%line : %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
+
+    <appender name="SYS_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <FileNamePattern>${LOG_HOME_PATH}/${SYS}/${APP_NAME}.%d{yyyy-MM-dd}.log</FileNamePattern>
+            <MaxHistory>30</MaxHistory>
+        </rollingPolicy>
+
+        <encoder>
+            <charset>UTF-8</charset>
+            <pattern>${SYS_LOG_PATTERN}</pattern>
+        </encoder>
+    </appender>
+
+
+    <appender name="BUSINESS_SQL_LOG_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <FileNamePattern>${LOG_HOME_PATH}/${USER}/${SQL}/%d{yyyy-MM-dd}.log</FileNamePattern>
+            <MaxHistory>10</MaxHistory>
+        </rollingPolicy>
+
+        <encoder>
+            <charset>UTF-8</charset>
+            <pattern>${BUSINESS_SQL_LOG_PATTERN}</pattern>
+        </encoder>
+    </appender>
+
+
+    <appender name="BUSINESS_OPERATION_LOG_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <FileNamePattern>${LOG_HOME_PATH}/${USER}/${OPT}/%d{yyyy-MM-dd}.log</FileNamePattern>
+            <MaxHistory>10</MaxHistory>
+        </rollingPolicy>
+
+        <encoder>
+            <charset>UTF-8</charset>
+            <pattern>${BUSINESS_OPERATION_LOG_PATTERN}</pattern>
+        </encoder>
+    </appender>
+
+
+    <appender name="BUSINESS_SCHEDULE_LOG_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <FileNamePattern>${LOG_HOME_PATH}/${USER}/${SCHEDULE}/%d{yyyy-MM-dd}.log</FileNamePattern>
+            <MaxHistory>10</MaxHistory>
+        </rollingPolicy>
+
+        <encoder>
+            <charset>UTF-8</charset>
+            <pattern>${BUSINESS_SCHEDULE_LOG_PATTERN}</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="BUSINESS_DOWNLOAD_LOG_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <FileNamePattern>${LOG_HOME_PATH}/${USER}/${DOWNLOAD}/%d{yyyy-MM-dd}.log</FileNamePattern>
+            <MaxHistory>10</MaxHistory>
+        </rollingPolicy>
+
+        <encoder>
+            <charset>UTF-8</charset>
+            <pattern>${BUSINESS_DOWNLOAD_LOG_PATTERN}</pattern>
+        </encoder>
+    </appender>
+
+
+    <logger name="BUSINESS_SQL" additivity="false" level="INFO">
+        <appender-ref ref="BUSINESS_SQL_LOG_APPENDER"/>
+    </logger>
+    <logger name="BUSINESS_OPERATION" additivity="false" level="INFO">
+        <appender-ref ref="BUSINESS_OPERATION_LOG_APPENDER"/>
+    </logger>
+    <logger name="BUSINESS_SCHEDULE" additivity="false" level="INFO">
+        <appender-ref ref="BUSINESS_SCHEDULE_LOG_APPENDER"/>
+    </logger>
+    <logger name="BUSINESS_DOWNLOAD" additivity="false" level="INFO">
+        <appender-ref ref="BUSINESS_DOWNLOAD_LOG_APPENDER"/>
+    </logger>
+
+
+    <root level="INFO">
+        <appender-ref ref="CONSOLE"/>
+        <appender-ref ref="SYS_LOG"/>
+    </root>
+
+</configuration>