[O] Make data dir if not exist

pull/14/head
Azalea 2024-02-19 01:36:39 -05:00
parent 195a8b4315
commit dc098d1ec7
1 changed files with 12 additions and 0 deletions

View File

@ -1,9 +1,11 @@
package icu.samnyan.aqua package icu.samnyan.aqua
import icu.samnyan.aqua.net.utils.EmailService
import icu.samnyan.aqua.sega.aimedb.AimeDbServer import icu.samnyan.aqua.sega.aimedb.AimeDbServer
import icu.samnyan.aqua.spring.util.AutoChecker import icu.samnyan.aqua.spring.util.AutoChecker
import org.springframework.boot.SpringApplication import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication import org.springframework.boot.autoconfigure.SpringBootApplication
import java.io.File
@SpringBootApplication @SpringBootApplication
class AquaServerApplication class AquaServerApplication
@ -12,11 +14,21 @@ class AquaServerApplication
* Main method, entry point of the application * Main method, entry point of the application
*/ */
fun main(args: Array<String>) { fun main(args: Array<String>) {
// If data/ is not found, create it
File("data").mkdirs()
// Run the application
val ctx = SpringApplication.run(AquaServerApplication::class.java, *args) val ctx = SpringApplication.run(AquaServerApplication::class.java, *args)
// Start the AimeDbServer
val aimeDbServer = ctx.getBean(AimeDbServer::class.java) val aimeDbServer = ctx.getBean(AimeDbServer::class.java)
aimeDbServer.start() aimeDbServer.start()
// Start the AutoChecker
val checker = ctx.getBean(AutoChecker::class.java) val checker = ctx.getBean(AutoChecker::class.java)
checker.check() checker.check()
// Test the email service
val emailService = ctx.getBean(EmailService::class.java)
emailService.testConnection()
} }