Class EnvUtils


  • public class EnvUtils
    extends java.lang.Object
    Util to get value from environments.
    • Field Detail

      • ENV_KUBERNETES_SERVICE_HOST

        public static final java.lang.String ENV_KUBERNETES_SERVICE_HOST
        See Also:
        Constant Field Values
      • ENV_WEBHOOK_KEYSTORE_FILE

        public static final java.lang.String ENV_WEBHOOK_KEYSTORE_FILE
        See Also:
        Constant Field Values
      • ENV_WEBHOOK_KEYSTORE_PASSWORD

        public static final java.lang.String ENV_WEBHOOK_KEYSTORE_PASSWORD
        See Also:
        Constant Field Values
      • ENV_WEBHOOK_KEYSTORE_TYPE

        public static final java.lang.String ENV_WEBHOOK_KEYSTORE_TYPE
        See Also:
        Constant Field Values
      • ENV_WEBHOOK_SERVER_PORT

        public static final java.lang.String ENV_WEBHOOK_SERVER_PORT
        See Also:
        Constant Field Values
      • ENV_CONF_OVERRIDE_DIR

        public static final java.lang.String ENV_CONF_OVERRIDE_DIR
        See Also:
        Constant Field Values
      • ENV_OPERATOR_NAME

        public static final java.lang.String ENV_OPERATOR_NAME
        See Also:
        Constant Field Values
      • ENV_OPERATOR_NAMESPACE

        public static final java.lang.String ENV_OPERATOR_NAMESPACE
        See Also:
        Constant Field Values
      • ENV_WATCH_NAMESPACES

        public static final java.lang.String ENV_WATCH_NAMESPACES
        See Also:
        Constant Field Values
    • Constructor Detail

      • EnvUtils

        public EnvUtils()
    • Method Detail

      • get

        public static java.util.Optional<java.lang.String> get​(java.lang.String key)
        Get the value provided by environments.
        Parameters:
        key - the target key
        Returns:
        the value value provided by environments.
      • getOrDefault

        public static java.lang.String getOrDefault​(java.lang.String key,
                                                    java.lang.String defaultValue)
        Get the value or default value provided by environments.
        Parameters:
        key - the target key
        defaultValue - the default value if key not exists.
        Returns:
        the value or default value provided by environments.
      • getRequired

        public static java.lang.String getRequired​(java.lang.String key)
        Get the value provided by environments.
        Parameters:
        key - the target key
        Returns:
        the value provided by environments.
      • logEnvironmentInfo

        public static void logEnvironmentInfo​(org.slf4j.Logger log,
                                              java.lang.String componentName,
                                              java.lang.String[] commandLineArgs)
        Logs information about the environment, like code revision, current user, Java version, and JVM parameters.
        Parameters:
        log - The logger to log the information to.
        componentName - The component name to mention in the log.
        commandLineArgs - The arguments accompanying the starting the component.