Update config file
This commit is contained in:
@@ -5,6 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.runApplication
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableTransactionManagement
|
||||
@@ -17,7 +18,14 @@ fun main(args: Array<String>) {
|
||||
runApplication<FatWebApiApplication>(*args)
|
||||
} else {
|
||||
logger.warn("File ‘application.yml’ cannot be found in the running path. The configuration file template 'application.example.yml' has been created. Please change the configuration file content and rename it to 'application.yml', and then restart the server.")
|
||||
FatWebApiApplication::class.java.getResource("/application-config-template.yml")?.readText()
|
||||
?.let { File("application-config.example.yml").writeText(it) }
|
||||
FatWebApiApplication::class.java.getResource("/application-config-template.yml")?.readText()
|
||||
?.let {
|
||||
File("application-config.example.yml").writeText(
|
||||
it.replace(
|
||||
"\$uuid\$",
|
||||
UUID.randomUUID().toString()
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package top.fatweb.api.constants
|
||||
package top.fatweb.api.constant
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.stereotype.Component
|
||||
import java.security.MessageDigest
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@Component
|
||||
@@ -16,14 +15,7 @@ object SecurityConstants {
|
||||
|
||||
var jwtTtlUnit = TimeUnit.HOURS
|
||||
|
||||
lateinit var jwtKey: String
|
||||
var jwtKey = "FatWeb"
|
||||
|
||||
private fun ByteArray.hex(): String {
|
||||
return joinToString("") { "%02X".format(it) }
|
||||
}
|
||||
|
||||
private fun String.md5(): String {
|
||||
val bytes = MessageDigest.getInstance("MD5").digest(this.toByteArray())
|
||||
return bytes.hex()
|
||||
}
|
||||
var jwtIssuer = "FatWeb"
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package top.fatweb.api.constants
|
||||
package top.fatweb.api.constant
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.stereotype.Component
|
||||
@@ -13,5 +13,6 @@ object ServerConstants {
|
||||
|
||||
lateinit var buildTime: String
|
||||
|
||||
fun buildZoneDateTime(zoneId: ZoneId = ZoneId.systemDefault()): ZonedDateTime = LocalDateTime.parse(buildTime).atZone(ZoneId.of("UTC")).withZoneSameInstant(zoneId)
|
||||
fun buildZoneDateTime(zoneId: ZoneId = ZoneId.systemDefault()): ZonedDateTime =
|
||||
LocalDateTime.parse(buildTime).atZone(ZoneId.of("UTC")).withZoneSameInstant(zoneId)
|
||||
}
|
||||
@@ -1,3 +1,12 @@
|
||||
app:
|
||||
security:
|
||||
# header-string: "Authorization" # The key of head to get token
|
||||
# token-prefix: "Bearer " # Token prefix
|
||||
# jwt-ttl: 2 # The life of token
|
||||
# jwt-ttl-unit: hours # Unit of life of token
|
||||
jwt-key: $uuid$ # Key to generate token
|
||||
# jwt-issuer: FatWeb # Token issuer
|
||||
|
||||
server:
|
||||
# port: 8080 # Server port
|
||||
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
app:
|
||||
version: @project.version@
|
||||
build-time: @build.timestamp@
|
||||
security:
|
||||
header-string: "Authorization"
|
||||
token-prefix: "Bearer "
|
||||
jwt-ttl: 2
|
||||
jwt-ttl-unit: hours
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
active: config
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
mybatis-plus:
|
||||
global-config:
|
||||
db-config:
|
||||
logic-delete-field: deleted
|
||||
logic-not-delete-value: 0
|
||||
logic-delete-value: id
|
||||
id-type: assign_id
|
||||
type-aliases-package: top.fatweb.api.entity
|
||||
|
||||
Reference in New Issue
Block a user