NAME

Env::Dot - Read environment variables from .env file

VERSION

version 0.003

SYNOPSIS

use Env::Dot;

print $ENV{'VAR_DEFINED_IN_DOTENV_FILE'};

DESCRIPTION

More flexibility in how you manage and use your .env file.

Features:

If no .env file is present, then do nothing

By default, Env::Dot will do nothing if there is no .env file. You can also configure Env::Dot to emit an alarm or break execution, if you want.

Specify the other dotenv files with path

If your .env file is located in another path, not the current working directory, you can use the environment variable DOTENV_FILEPATHS to tell where your dotenv file is located. You can specify several file paths; just separate them by :. Dot::Env will load all the files in the order you specify them.

Support different types of .env files

Unix Shell source command compatible dotenv files use quotation marks (") to define a variable which has spaces. But, for instance, Docker compatible .env files do not use quotation marks. The variable content begins with = sign and ends with linefeed.

You can specify in the dotenv file itself - by using meta commands - which type of file it is.

Use executable envdot to bring the variables into your shell

The executable is distributed together with Dot::Env package in directory script.

eval "$(envdot)"

STATUS

Package Env::Dot is currently being developed so changes in the API are possible, though not likely.

DEPENDENCIES

No external dependencies outside Perl's standard distribution.

FUNCTIONS

No functions are automatically exported to the calling namespace.

load_vars

Load variables from .env file or files in environment variable ENVDOT_FILEPATHS.

SEE ALSO

Env::Assert will verify that you certainly have those environmental variables you need. It also has an executable which can perform the check in the beginning of a docker container run.

Dotenv is another package which implements functionality to use .env files in Perl.

AUTHOR

'Mikko Koivunalho <mikkoi@cpan.org>'

COPYRIGHT AND LICENSE

This software is copyright (c) 2023 by Mikko Koivunalho.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.