package com.sf.vertx.constans;

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

@Component
public class RedisKeyConfig {

	@Value("${server.vertx.environment}")
	private String vertxEnvironment;

	public static final String BASE_REDIS_KEY = "vertx:config:";
	public static String APP_CONFIG_SET_KEY = null;
	public static String APP_CURRENT_LIMITING_CONFIG_KEY = null;
	public static String APP_CONFIG_PREFIX_KEY = null;
	public static String VERTX_CONFIG_STRING_KEY = null;
	public static String VERTX_ADDRESS_RETRY_STRATEGY_SET_KEY = null;
	public static String VERTX_ADDRESS_RETRY_STRATEGY_KEY = null;

	public void init() {
		APP_CONFIG_PREFIX_KEY = BASE_REDIS_KEY + vertxEnvironment;
		APP_CONFIG_SET_KEY = APP_CONFIG_PREFIX_KEY + ":set";
		APP_CURRENT_LIMITING_CONFIG_KEY = APP_CONFIG_PREFIX_KEY + ":app:limiting";
		VERTX_CONFIG_STRING_KEY = BASE_REDIS_KEY + vertxEnvironment + ":vertx";
		VERTX_ADDRESS_RETRY_STRATEGY_KEY = APP_CONFIG_PREFIX_KEY + ":addAddressRetryStrategy";
		VERTX_ADDRESS_RETRY_STRATEGY_SET_KEY = VERTX_ADDRESS_RETRY_STRATEGY_KEY + ":set";
	}
}
