|
@@ -9,7 +9,6 @@ import org.springframework.scheduling.annotation.EnableScheduling
|
|
import java.io.File
|
|
import java.io.File
|
|
import java.io.Serializable
|
|
import java.io.Serializable
|
|
import java.util.*
|
|
import java.util.*
|
|
-import kotlin.system.exitProcess
|
|
|
|
|
|
|
|
|
|
|
|
@SpringBootApplication
|
|
@SpringBootApplication
|
|
@@ -19,17 +18,23 @@ class IpPhoneBridgeApplication
|
|
fun main(args: Array<String>) {
|
|
fun main(args: Array<String>) {
|
|
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Jakarta"))
|
|
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Jakarta"))
|
|
val properties = Properties()
|
|
val properties = Properties()
|
|
- val confFile = File("conf/general.ini")
|
|
|
|
- if (confFile.exists()) {
|
|
|
|
- val ini = Wini(File("conf/general.ini"))
|
|
|
|
- properties["server.port"] = ini.get("server", "port")
|
|
|
|
- } else {
|
|
|
|
- properties["server.port"] = System.getenv("PORT")
|
|
|
|
- }
|
|
|
|
- if (properties["server.port"] == null) {
|
|
|
|
- exitProcess(1)
|
|
|
|
|
|
+ val iniFIle = File("conf/general.ini")
|
|
|
|
+
|
|
|
|
+ properties["server.port"] = when {
|
|
|
|
+ System.getenv("PORT") != null -> {
|
|
|
|
+ System.getenv("PORT")
|
|
|
|
+ }
|
|
|
|
+ iniFIle.exists() -> {
|
|
|
|
+ val ini = Wini(iniFIle)
|
|
|
|
+ ini.get("server", "port") ?: "9090"
|
|
|
|
+ }
|
|
|
|
+ else -> {
|
|
|
|
+ "9090"
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
val sApp = SpringApplication(IpPhoneBridgeApplication::class.java)
|
|
val sApp = SpringApplication(IpPhoneBridgeApplication::class.java)
|
|
|
|
|
|
sApp.setDefaultProperties(properties)
|
|
sApp.setDefaultProperties(properties)
|