Class HelixSpringProfileResolver

java.lang.Object
com.helixframework.env.HelixSpringProfileResolver

public final class HelixSpringProfileResolver extends Object
Utility class responsible for resolving the current application environment/profile based on Spring Boot configuration properties, Helix-specific environment configurations, and corresponding environment variables. This class provides methods to extract the environment configuration using either predefined properties or environment variables. It also includes helpers to detect specific environments like "local" or "default".
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Represents the name of the environment variable used to specify the Helix-specific environment.
    static final String
    A constant property name used to specify the environment in Helix configurations.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Checks if the current environment is set to the default environment.
    static boolean
    Determines whether the current environment is set to "local".
    static String
    Resolves the current environment/profile based on Spring Boot and Helix specific configuration properties and environment variables.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ENV_ENVIRONMENT

      public static final String ENV_ENVIRONMENT
      Represents the name of the environment variable used to specify the Helix-specific environment. The variable is typically used to override or define the application environment independently of Spring Boot's "spring.profiles.active" configuration. The value of this constant is "HELIX_ENV".
      See Also:
    • PROP_ENVIRONMENT

      public static final String PROP_ENVIRONMENT
      A constant property name used to specify the environment in Helix configurations. This property is typically used to define the environment value (e.g., "dev", "prod", "local"), which can be resolved via either system properties or environment variables. The value associated with this property (`"helix.env"`) acts as a key for looking up the environment configuration in the system property or environment variable scope. This property is considered during the process of resolving the current application environment.
      See Also:
  • Constructor Details

    • HelixSpringProfileResolver

      public HelixSpringProfileResolver()
  • Method Details

    • resolve

      public static String resolve()
      Resolves the current environment/profile based on Spring Boot and Helix specific configuration properties and environment variables.
      Returns:
      The resolved environment name
    • isLocal

      public static boolean isLocal()
      Determines whether the current environment is set to "local".
      Returns:
      true if the environment is "local", false otherwise
    • isDefault

      public static boolean isDefault()
      Checks if the current environment is set to the default environment.
      Returns:
      true if the current environment is the default environment, false otherwise