Class EnvFileVar


public class EnvFileVar extends DefaultingVar
Environment-file variable resolver.

The format for this var is "${EF:key[:default]}".

This variable is functionally identical to DotenvVar, but provides a generic env-file naming option for callers that do not want dotenv-specific naming.

  • Field Details

  • Constructor Details

  • Method Details

    • create

      public static EnvFileVar create(Path path)
      Creates an EnvFileVar bound to a specific env file path.
      Parameters:
      path - The env file path. Can be null, in which case no properties are loaded.
      Returns:
      A new EnvFileVar instance.
    • allowRecurse

      protected boolean allowRecurse()
      Values from this source are never re-resolved: a value containing ${...} is returned literally.
      Overrides:
      allowRecurse in class Var
      Returns:
      Always false.
    • resolve

      public String resolve(VarResolverSession session, String key)
      Description copied from class: Var
      The interface that needs to be implemented for subclasses of SimpleVar.
      Specified by:
      resolve in class Var
      Parameters:
      session - The session object used for a single instance of a var resolution.
      key - The inside argument of the variable.
      Returns:
      The resolved value.