module LuckyEnv
Defined in:
lucky_env.crlucky_env/errors.cr
lucky_env/parser.cr
Constant Summary
-
VERSION =
{{ (`shards version \"/home/runner/work/lucky_env/lucky_env/src\"`).chomp.stringify }}
Class Method Summary
- .development? : Bool
- .environment : String
-
.load(file_path : String) : Hash(String, String)
Parses the
file_path
, and loads the results in toENV
raisesLuckyEnv::MissingFileError
if the file is missing -
.load : Hash(String, String)
Loads the appropriate environment file from the project root directory based on the value of
ENV["LUCKY_ENV"]
. -
.load?(file_path : String) : Hash(String, String) | Nil
Returns
nil
if the file is missing - .production? : Bool
- .task? : Bool
- .test? : Bool
Macro Summary
Class Method Detail
def self.load(file_path : String) : Hash(String, String)
#
Parses the file_path
, and loads the results in to ENV
raises LuckyEnv::MissingFileError
if the file is missing
def self.load : Hash(String, String)
#
Loads the appropriate environment file from the project root directory based on the value of ENV["LUCKY_ENV"]
.
This method attempts to read one of the following files depending on the environment:
.env.development
for the development environment.env.production
for the production environment.env.testing
for the testing environment
Falls back to reading .env
if no specific file is found for the current environment.
raises LuckyEnv::MissingFileError if no environment file is found.
def self.load?(file_path : String) : Hash(String, String) | Nil
#
Returns nil
if the file is missing