forked from Minecraft/Stonks
Use configuration file stonks.config
parent
a4140f708c
commit
a50a8a8ac9
|
@ -58,6 +58,8 @@ dependencies {
|
||||||
|
|
||||||
implementation("joda-time:joda-time:2.10.10")
|
implementation("joda-time:joda-time:2.10.10")
|
||||||
implementation("com.beust:klaxon:5.5")
|
implementation("com.beust:klaxon:5.5")
|
||||||
|
|
||||||
|
implementation("com.natpryce:konfig:1.6.10.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package xyz.etztech.stonks
|
package xyz.etztech.stonks
|
||||||
|
|
||||||
|
import com.natpryce.konfig.*
|
||||||
|
import java.io.FileInputStream
|
||||||
|
import java.util.*
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import org.h2.tools.Server
|
import org.h2.tools.Server
|
||||||
import org.jetbrains.exposed.exceptions.ExposedSQLException
|
import org.jetbrains.exposed.exceptions.ExposedSQLException
|
||||||
|
@ -14,11 +17,19 @@ fun main() =
|
||||||
runBlocking {
|
runBlocking {
|
||||||
println("Starting Stonks...")
|
println("Starting Stonks...")
|
||||||
|
|
||||||
val databaseBaseDir = "./databases"
|
val fis = FileInputStream("./stonks.config")
|
||||||
val databaseName = "statistics"
|
val config = Properties()
|
||||||
val h2StartWebServer = true
|
|
||||||
val h2tWebServerPort = 8082
|
config.load(fis)
|
||||||
val h2TcpServerPort = 9092
|
|
||||||
|
val databaseBaseDir = config.getProperty("databaseBaseDir")
|
||||||
|
val databaseName = config.getProperty("databaseName")
|
||||||
|
val h2StartWebServer = config.getProperty("h2StartWebServer").toBoolean()
|
||||||
|
val h2tWebServerPort = config.getProperty("h2tWebServerPort").toInt()
|
||||||
|
val h2TcpServerPort = config.getProperty("h2TcpServerPort").toInt()
|
||||||
|
val apiServerPort = config.getProperty("apiServerPort").toInt()
|
||||||
|
val periodicFetchingInterval = config.getProperty("periodicFetchingInterval").toLong()
|
||||||
|
val minecraftStatsFolder = config.getProperty("minecraftStatsFolder")
|
||||||
|
|
||||||
val database =
|
val database =
|
||||||
initH2Server(
|
initH2Server(
|
||||||
|
@ -28,13 +39,8 @@ fun main() =
|
||||||
h2StartWebServer,
|
h2StartWebServer,
|
||||||
h2tWebServerPort)
|
h2tWebServerPort)
|
||||||
|
|
||||||
val apiServerPort = 7000
|
|
||||||
|
|
||||||
initApiServer(apiServerPort, database)
|
initApiServer(apiServerPort, database)
|
||||||
|
|
||||||
val periodicFetchingInterval = 15 * 60 * 1000L
|
|
||||||
val minecraftStatsFolder = "../test_data"
|
|
||||||
|
|
||||||
initPeriodicFetching(periodicFetchingInterval, minecraftStatsFolder, database)
|
initPeriodicFetching(periodicFetchingInterval, minecraftStatsFolder, database)
|
||||||
|
|
||||||
delay(60 * 1000L)
|
delay(60 * 1000L)
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
databaseBaseDir=./databases
|
||||||
|
databaseName=statistics
|
||||||
|
h2StartWebServer=true
|
||||||
|
h2tWebServerPort=8082
|
||||||
|
h2TcpServerPort=9092
|
||||||
|
apiServerPort=7000
|
||||||
|
periodicFetchingInterval=900000
|
||||||
|
minecraftStatsFolder=../test_data
|
Loading…
Reference in New Issue