package cn.reghao.oss.store.config.props;

import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.stereotype.Component;

/**
 * @author reghao
 * @date 2024-02-23 12:58:00
 */
@Component
public class SpringProperties {
    private final ServerProperties serverProperties;
    private final DubboProperties dubboProperties;
    private final OssProperties ossProperties;

    public SpringProperties(ServerProperties serverProperties, DubboProperties dubboProperties,
                            OssProperties ossProperties) {
        this.serverProperties = serverProperties;
        this.dubboProperties = dubboProperties;
        this.ossProperties = ossProperties;
    }

    public String getNodeAddress() {
        return ossProperties.getHost();
    }

    public int getHttpPort() {
        return serverProperties.getPort();
    }

    public int getRpcPort() {
        return dubboProperties.getProtocol().getPort();
    }
}
