PtcRunner.Dotenv (PtcRunner v0.14.0)

Copy Markdown View Source

Loads environment variables from an explicitly named dotenv file.

Existing process environment variables take precedence over file values. Command frontends use --env-file FILE to choose the exact file; this module does not search the invocation directory or its parents implicitly.

Examples

PtcRunner.Dotenv.load_file(".env")

Summary

Functions

Parse path as a .env file and set the variables it declares.

Types

file_error()

@type file_error() ::
  :environment_file_not_found
  | :environment_file_not_regular
  | :environment_file_unreadable
  | :environment_file_too_large
  | :environment_file_invalid_utf8

Functions

load_file(path)

@spec load_file(String.t()) :: :ok | {:error, file_error()}

Parse path as a .env file and set the variables it declares.

Lines are KEY=VALUE; blank lines and # comments are ignored. Surrounding single or double quotes are stripped from the value. Existing environment variables are never overwritten.