Compare commits
3 Commits
ab915d0a41
...
dfa6b28a66
| Author | SHA1 | Date | |
|---|---|---|---|
| dfa6b28a66 | |||
| b945a0d677 | |||
| 2ae91ebd66 |
@ -7,67 +7,29 @@ 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,6 +1,7 @@
|
|||||||
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
|
||||||
@ -39,9 +40,39 @@ class Telegram {
|
|||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@PostMapping("webhook")
|
@PostMapping("webhook")
|
||||||
fun test(@RequestBody str : String) {
|
fun test(httpServletRequest: HttpServletRequest, @RequestBody update : TelegramUpdate?) {
|
||||||
println("path >>> $str")
|
try {
|
||||||
|
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,6 +3,22 @@ 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
|
||||||
@ -33,3 +49,4 @@ 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
|
||||||
|
|||||||
BIN
src/main/resources/prv.p12
Normal file
BIN
src/main/resources/prv.p12
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user