Skip to content

Commit be09904

Browse files
committed
feat(be): enable simple broker in non-prod profiles
1 parent a4cd39c commit be09904

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.back.koreaTravelGuide.domain.userChat.stomp
2+
3+
import org.springframework.context.annotation.Configuration
4+
import org.springframework.context.annotation.Profile
5+
import org.springframework.messaging.simp.config.ChannelRegistration
6+
import org.springframework.messaging.simp.config.MessageBrokerRegistry
7+
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker
8+
import org.springframework.web.socket.config.annotation.StompEndpointRegistry
9+
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
10+
11+
@Profile("!prod")
12+
@Configuration
13+
@EnableWebSocketMessageBroker
14+
class UserChatSimpleWebSocketConfig(
15+
private val userChatStompAuthChannelInterceptor: UserChatStompAuthChannelInterceptor,
16+
) : WebSocketMessageBrokerConfigurer {
17+
override fun registerStompEndpoints(registry: StompEndpointRegistry) {
18+
registry.addEndpoint("/ws/userchat")
19+
.setAllowedOriginPatterns("*")
20+
.withSockJS()
21+
}
22+
23+
override fun configureMessageBroker(registry: MessageBrokerRegistry) {
24+
registry.setApplicationDestinationPrefixes("/pub")
25+
registry.enableSimpleBroker("/topic")
26+
}
27+
28+
override fun configureClientInboundChannel(registration: ChannelRegistration) {
29+
registration.interceptors(userChatStompAuthChannelInterceptor)
30+
}
31+
}

src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ springdoc:
143143
# Weather API 설정
144144
weather:
145145
api:
146-
key: ${WEATHER__API__KEY}
146+
key: ${WEATHER_API_KEY}
147147
base-url: https://apihub.kma.go.kr/api/typ02/openApi/MidFcstInfoService
148148

149149
# Tour API 설정

src/test/kotlin/com/back/koreaTravelGuide/domain/ai/tour/service/TourParamsParserTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package com.back.koreaTravelGuide.domain.ai.tour.service
22

3-
import kotlin.test.assertEquals
4-
import kotlin.test.assertNull
53
import org.junit.jupiter.api.DisplayName
64
import org.junit.jupiter.api.Test
5+
import kotlin.test.assertEquals
6+
import kotlin.test.assertNull
77

88
class TourParamsParserTest {
99
private val parser = TourParamsParser()

0 commit comments

Comments
 (0)