Class LoadEnv

java.lang.Object
com.alpaca.utils.LoadEnv

public class LoadEnv extends Object
Utility class for loading environment variables from a `.env` file into JVM system properties.

This class uses the `dotenv-java` library to read key-value pairs from a `.env` file and transparently inject them into the runtime as system properties via System.setProperty(java.lang.String, java.lang.String).

This approach supports use cases where environment variables need to be accessible through System.getProperty(java.lang.String) instead of System.getenv(java.lang.String), enabling smoother integration with libraries or frameworks that rely on system properties.

See Also:
  • Dotenv
  • Constructor Details

    • LoadEnv

      public LoadEnv()
  • Method Details

    • init

      public static void init()
      Loads all entries from the `.env` file into JVM system properties. If a property already exists in the system, it will not be overwritten by default, preserving environment-based configurations over file-based ones.

      This method should be invoked early in application startup to ensure configuration values are available for the rest of the runtime.