Compare commits
No commits in common. "dfa6b28a668e6c3e3693e81ab5704aa0de638f88" and "ab915d0a416c69708f1df1ad76d7a14c779c1f59" have entirely different histories.
dfa6b28a66
...
ab915d0a41
@ -7,29 +7,67 @@ import org.springframework.context.EnvironmentAware
|
|||||||
import org.springframework.core.env.Environment
|
import org.springframework.core.env.Environment
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling
|
import org.springframework.scheduling.annotation.EnableScheduling
|
||||||
import org.springframework.stereotype.Component
|
import org.springframework.stereotype.Component
|
||||||
import org.springframework.web.reactive.function.client.WebClient
|
|
||||||
|
|
||||||
|
|
||||||
@EnableScheduling // 추가
|
@EnableScheduling // 추가
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
class LunApplication {
|
class LunApplication() {
|
||||||
init {
|
|
||||||
val client = WebClient.create()
|
|
||||||
client.get()
|
|
||||||
.uri("https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=71476436&text=SERVER_START")
|
|
||||||
.retrieve()
|
|
||||||
.bodyToMono(String::class.java).block() ?: "FAIL"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//@Component
|
||||||
|
//class GEnv : EnvironmentAware {
|
||||||
|
// @Value("\${telegram.bot.key}")
|
||||||
|
// var telegramBotKey: String? = ""
|
||||||
|
//
|
||||||
|
// @Value("\${telegram.my.id}")
|
||||||
|
// var telegramMyId: String? = ""
|
||||||
|
//
|
||||||
|
// @Value("\${weather.api.key}")
|
||||||
|
// var weatherApiKey: String? = ""
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// override fun setEnvironment(environment: Environment) {
|
||||||
|
// println ("telegramBotKey $telegramBotKey")
|
||||||
|
// println("telegramMyId $telegramMyId")
|
||||||
|
// println("weatherApiKey $weatherApiKey")
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main(args: Array<String>) {
|
||||||
|
// val props = System.getProperties()
|
||||||
|
// val enumerator = props.keys()
|
||||||
|
// while (enumerator.hasMoreElements()) {
|
||||||
|
// val ele = enumerator.nextElement()
|
||||||
|
// val key = ele.toString()
|
||||||
|
// println(key + ": " + System.getProperty(key))
|
||||||
|
// }
|
||||||
args.forEach {
|
args.forEach {
|
||||||
println("main ARG >> $it")
|
println("main ARG >> $it")
|
||||||
}
|
}
|
||||||
runApplication<LunApplication>(*args)
|
runApplication<LunApplication>(*args)
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
//@SpringBootApplication
|
||||||
|
//class Application {
|
||||||
|
// @Bean
|
||||||
|
// fun commandLineRunner(ctx: ApplicationContext): CommandLineRunner {
|
||||||
|
// return CommandLineRunner { args: Array<String?>? ->
|
||||||
|
// println("Let's inspect the beans provided by Spring Boot:")
|
||||||
|
// val beanNames: Array<String> = ctx.getBeanDefinitionNames()
|
||||||
|
// Arrays.sort(beanNames)
|
||||||
|
// for (beanName in beanNames) {
|
||||||
|
// println(beanName)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// companion object {
|
||||||
|
// @JvmStatic
|
||||||
|
// fun main(args: Array<String>) {
|
||||||
|
// SpringApplication.run(Application::class.java, *args)
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@ -1,7 +1,6 @@
|
|||||||
package kr.lunaticbum.back.lun.controllers
|
package kr.lunaticbum.back.lun.controllers
|
||||||
|
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import jakarta.servlet.http.HttpServletRequest
|
|
||||||
import kotlinx.coroutines.GlobalScope
|
import kotlinx.coroutines.GlobalScope
|
||||||
import kotlinx.coroutines.flow.asFlow
|
import kotlinx.coroutines.flow.asFlow
|
||||||
import kotlinx.coroutines.flow.onCompletion
|
import kotlinx.coroutines.flow.onCompletion
|
||||||
@ -40,39 +39,9 @@ class Telegram {
|
|||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping("webhook")
|
@PostMapping("webhook")
|
||||||
fun test(httpServletRequest: HttpServletRequest, @RequestBody update : TelegramUpdate?) {
|
fun test(@RequestBody str : String) {
|
||||||
try {
|
println("path >>> $str")
|
||||||
logService.log("test strat ${update}")
|
|
||||||
logService.log("test strat ${httpServletRequest.requestURI}")
|
|
||||||
// val client0 = WebClient.create()
|
|
||||||
// client0.get()
|
|
||||||
// .uri("https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/getUpdates")
|
|
||||||
// .retrieve()
|
|
||||||
// .bodyToMono(String::class.java).subscribe { result ->
|
|
||||||
logService.log("test $httpServletRequest.requestURI")
|
|
||||||
// var sss = Gson().fromJson<TelegramUpdate>(jsonString, TelegramUpdate::class.java)
|
|
||||||
// if (sss.ok) {
|
|
||||||
// var doSend = false
|
|
||||||
// sss.result?.forEach {
|
|
||||||
// if (!doSend) doSend = it.message?.text?.contains("어디") ?: false
|
|
||||||
// }
|
|
||||||
// if (doSend) {
|
|
||||||
// val client = WebClient.create()
|
|
||||||
// client.get()
|
|
||||||
// .uri("https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=71476436&text=OK")
|
|
||||||
// .retrieve()
|
|
||||||
// .bodyToMono(String::class.java).block() ?: "FAIL"
|
|
||||||
// }
|
|
||||||
// logger.log("test OK")
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
} catch (e : Exception) {
|
|
||||||
//=======
|
|
||||||
// fun test(@RequestBody str : String) {
|
|
||||||
// println("path >>> $str")
|
|
||||||
//>>>>>>> ab915d0a416c69708f1df1ad76d7a14c779c1f59
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,22 +3,6 @@ server.port=443
|
|||||||
spring.datasource.username=c
|
spring.datasource.username=c
|
||||||
spring.datasource.password=c
|
spring.datasource.password=c
|
||||||
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
|
||||||
#<<<<<<< HEAD
|
|
||||||
#spring.data.mongodb.host=nas.lunaticbum.kr
|
|
||||||
#spring.data.mongodb.host=localhost
|
|
||||||
#spring.data.mongodb.port=27017
|
|
||||||
#spring.data.mongodb.database=lun_db
|
|
||||||
#SSL
|
|
||||||
server.ssl.key-store=classpath:prv.p12
|
|
||||||
server.ssl.key-store-type=PKCS12
|
|
||||||
server.ssl.key-store-password=VioPup*383
|
|
||||||
server.http2.enabled=true
|
|
||||||
#spring.main.web-application-type=SERVLET
|
|
||||||
#logging.level.org.springframework.boot.autoconfigure=ERROR
|
|
||||||
#spring.mvc.view.prefix=/templates
|
|
||||||
#spring.mvc.view.suffix=.html
|
|
||||||
#server.servlet.register-default-servlet=true
|
|
||||||
#=======
|
|
||||||
spring.datasource.url=b
|
spring.datasource.url=b
|
||||||
spring.data.mongodb.uri=a
|
spring.data.mongodb.uri=a
|
||||||
spring.data.mongodb.authentication-database=admin
|
spring.data.mongodb.authentication-database=admin
|
||||||
@ -48,5 +32,4 @@ spring.data.mongodb.option.heartbeat-socket-timeout=20000
|
|||||||
spring.data.mongodb.option.heartbeat-connect-timeout=20000
|
spring.data.mongodb.option.heartbeat-connect-timeout=20000
|
||||||
spring.data.mongodb.option.min-heartbeat-frequency=500
|
spring.data.mongodb.option.min-heartbeat-frequency=500
|
||||||
spring.data.mongodb.option.heartbeat-frequency=10000
|
spring.data.mongodb.option.heartbeat-frequency=10000
|
||||||
spring.data.mongodb.option.local-threshold=15
|
spring.data.mongodb.option.local-threshold=15
|
||||||
#>>>>>>> ab915d0a416c69708f1df1ad76d7a14c779c1f59
|
|
||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user