Change namespace to top.fatweb.oxygen.api
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package top.fatweb.oxygen.api.properties
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
* Admin properties
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties("app.admin")
|
||||
object AdminProperties {
|
||||
/**
|
||||
* Username
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var username = "admin"
|
||||
|
||||
/**
|
||||
* Password
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var password: String? = null
|
||||
|
||||
/**
|
||||
* Nickname
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var nickname = "Administrator"
|
||||
|
||||
/**
|
||||
* Email
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var email = "admin@mail.com"
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package top.fatweb.oxygen.api.properties
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.stereotype.Component
|
||||
|
||||
/**
|
||||
* Flyway properties
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties("spring.flyway")
|
||||
object FlywayProperties {
|
||||
/**
|
||||
* Locations of migrations scripts. Can contain the special "{vendor}" placeholder to
|
||||
* use vendor-specific locations.
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var locations = listOf("classpath:db/migration")
|
||||
|
||||
/**
|
||||
* Name of the schema history table that will be used by Flyway.
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var table = "flyway_schema_history"
|
||||
|
||||
/**
|
||||
* Whether to allow migrations to be run out of order.
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var outOfOrder = false
|
||||
|
||||
/**
|
||||
* Whether to automatically call validate when performing a migration.
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var validateOnMigrate = true
|
||||
|
||||
/**
|
||||
* Encoding of SQL migrations.
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var encoding = Charsets.UTF_8
|
||||
|
||||
/**
|
||||
* File name prefix for SQL migrations.
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var sqlMigrationPrefix = "V"
|
||||
|
||||
/**
|
||||
* File name separator for SQL migrations.
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var sqlMigrationSeparator = "__"
|
||||
|
||||
/**
|
||||
* File name suffix for SQL migrations.
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var sqlMigrationSuffixes = listOf(".sql")
|
||||
|
||||
/**
|
||||
* Whether to automatically call baseline when migrating a non-empty schema.
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var baselineOnMigrate = true
|
||||
|
||||
/**
|
||||
* Version to tag an existing schema with when executing baseline.
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var baselineVersion = "0"
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package top.fatweb.oxygen.api.properties
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.stereotype.Component
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* Security properties
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties("app.security")
|
||||
object SecurityProperties {
|
||||
/**
|
||||
* Key to get authentication from header
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var headerKey = "Authorization"
|
||||
|
||||
/**
|
||||
* Prefix of token
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var tokenPrefix = "Bearer "
|
||||
|
||||
/**
|
||||
* TTL of JWT
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var jwtTtl = 2L
|
||||
|
||||
/**
|
||||
* TTL unit of JWT
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var jwtTtlUnit = TimeUnit.HOURS
|
||||
|
||||
/**
|
||||
* Key of JWT
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var jwtKey = "Oxygen"
|
||||
|
||||
/**
|
||||
* Issuer of JWT
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var jwtIssuer = "Oxygen"
|
||||
|
||||
/**
|
||||
* TTL of redis
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var redisTtl = 20L
|
||||
|
||||
/**
|
||||
* TTL unit of redis
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
var redisTtlUnit = TimeUnit.MINUTES
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package top.fatweb.oxygen.api.properties
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties
|
||||
import org.springframework.stereotype.Component
|
||||
import java.time.LocalDateTime
|
||||
import java.time.ZoneId
|
||||
import java.time.ZoneOffset
|
||||
import java.time.ZonedDateTime
|
||||
|
||||
/**
|
||||
* Application properties
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Component
|
||||
@ConfigurationProperties("app")
|
||||
object ServerProperties {
|
||||
/**
|
||||
* App name
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
lateinit var appName: String
|
||||
|
||||
/**
|
||||
* Version
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
lateinit var version: String
|
||||
|
||||
/**
|
||||
* Build time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
lateinit var buildTime: String
|
||||
|
||||
/**
|
||||
* Startup time
|
||||
*
|
||||
* @author FatttSnake, fatttsnake@gmail.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
val startupTime: LocalDateTime = LocalDateTime.now(ZoneOffset.UTC)
|
||||
|
||||
fun buildZoneDateTime(zoneId: ZoneId = ZoneId.systemDefault()): ZonedDateTime =
|
||||
LocalDateTime.parse(buildTime).atZone(ZoneId.of("UTC")).withZoneSameInstant(zoneId)
|
||||
}
|
||||
Reference in New Issue
Block a user