package com.samsung.embo.api.config;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import com.samsung.config.WebClientConfig;
import com.samsung.embo.api.util.GhrpSupport;

import lombok.extern.log4j.Log4j2;

@Component

public class GhrpConfig implements InitializingBean{

	private static final org.apache.logging.log4j.Logger log = org.apache.logging.log4j.LogManager.getLogger(GhrpConfig.class);

    @Value("${ghrp.token}")
    private String tokenStr;

    @Value("${ghrp.address.prefix}")
    private String hostStr;



    @Value("${ghrp.default-protocol}")
    public void setDefaultProtocol(String defaultProtocol) {
    	GhrpSupport.DEFAULT_PROTOCOL = defaultProtocol;
    }



	public void afterPropertiesSet() throws Exception {

		log.debug("GhrpConfig afterPropertiesSet");
		GhrpSupport.HOST = this.hostStr;
		GhrpSupport.TOKEN = this.tokenStr;
	}

}
