package cn.reghao.oss.store.config;

import cn.reghao.oss.api.iface.ConsoleService;
import cn.reghao.oss.store.config.props.OssProperties;
import cn.reghao.oss.store.rpc.RemoteService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author reghao
 * @date 2024-02-28 11:11:04
 */
@Configuration
public class BeansConfig {
    @Bean
    public ConsoleService nodeService(OssProperties ossProperties) {
        RemoteService<ConsoleService> remoteService = new RemoteService<>();
        String host = ossProperties.getConsoleHost();
        int port = ossProperties.getConsolePort();
        return remoteService.getService(host, port, ConsoleService.class);
    }
}
