Skip to content

Commit ed38654

Browse files
committed
(TP-105) feat: OpenRouterConfig
1 parent eca7c7f commit ed38654

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package kattsyn.dev.rentplace.configs;
2+
3+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
4+
import org.springframework.context.annotation.Bean;
5+
import org.springframework.context.annotation.Configuration;
6+
import org.springframework.http.HttpHeaders;
7+
import org.springframework.web.reactive.function.client.WebClient;
8+
9+
@Configuration
10+
@EnableConfigurationProperties(OpenRouterProperties.class)
11+
public class OpenRouterConfig {
12+
13+
@Bean
14+
public WebClient webClient(OpenRouterProperties props) {
15+
return WebClient.builder()
16+
.baseUrl(props.url())
17+
.defaultHeader(HttpHeaders.AUTHORIZATION, "Bearer " + props.key())
18+
.build();
19+
}
20+
21+
}

0 commit comments

Comments
 (0)