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)
|
||||
}
|
||||
Reference in New Issue
Block a user