class Poncho::Loader

Overview

Poncho::Loader is a .env file loader

Poncho loads the environment file is easy to use. It accepts both single file (or path) and multiple files.

Orders

Poncho loads single file supports the following order with environment name (default is development):

NO effect with multiple files, it only loads the given files.

Overrides

By default, Poncho won't overwrite existing environment variables as dotenv assumes the deployment environment has more knowledge about configuration than the application does.

Load single file

loader = Poncho::Loader.new env: "development"
loader.load ".env"

Load multiple files

loader = Poncho::Loader.new
loader.load ".env", ".env.local"

Defined in:

poncho/loader.cr

Constant Summary

DEFAULT_ENV_NAME = "development"

Constructors

Instance Method Summary

Constructor Detail

def self.new(env : String | Nil = nil) #

[View source]

Instance Method Detail

def load(*paths, overwrite = false) #

Load environment variables


[View source]
def load!(*paths) #

Load environment variables and overwrite existing ones.

Same as #load(*files, overwrite: true)


[View source]