dotenv icon indicating copy to clipboard operation
dotenv copied to clipboard

This package doesn't seem to work for a dart cli

Open duck-dev-go opened this issue 2 years ago • 1 comments

As soon as you build an executable for your dart cli and run that executable from the terminal. It can't find the .env file and throws the following error

[dotenv] Load failed: file not found: File: 'production.env'

duck-dev-go avatar Jan 05 '23 13:01 duck-dev-go

This package only load the host machine environment and/or a external environment file that must be available on the host machine at runtime.

If you are looking for bundling your environment variables in production, you need to define it when compiling your binary.

To specify an environment declaration when running or compiling a Dart application, use the --define option or its abbreviation, -D. Specify the declaration key-value pair using a <NAME>=<VALUE> format:

dart run --define=DEBUG=true -DFLAVOR=free

See: https://dart.dev/guides/environment-declarations.

alexcmgit avatar Mar 12 '23 15:03 alexcmgit