package com.kmall.common.utils.express.kdn;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * @author Scott Chen
 * @since 1.0
 * 2018-09-27
 */
@Component
public class KdnPropertiesConfiguration {
    private static final String PROD = "prod";
    private static final String DEV = "dev";

    @Value("${express.kdn.env}")
    private String evn = PROD;

    @Autowired
    private KdnProdProperties kdnProdProperties;

    @Autowired
    private KdnDevProperties kdnDevProperties;

    @Bean
    public KdnProperties kdnProperties(){
        if (evn.equalsIgnoreCase(PROD)) {
            return kdnProdProperties;
        }else {
            return kdnDevProperties;
        }
    }

}
