package com.example.Portfolio.Configs;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.web.reactive.function.client.WebClient;

@Configuration
public class GiteaClientConfig {

    @Bean
    public WebClient giteaWebClient(
            @Value("${gitea.api.url}") String baseUrl,
            @Value("${gitea.token}") String token) {

        return WebClient.builder()
                .baseUrl(baseUrl)
                .defaultHeader(HttpHeaders.AUTHORIZATION, "token " + token)
                .build();
    }
}