define_env 0.2.0+2 define_env: ^0.2.0+2 copied to clipboard
Load variables from a `.env` file into a dart-define string and copy it to your IDE Config or to the clipboard.
define_env #
Load variables from a .env
file into a dart-define string and copy it to your IDE Config or to the clipboard.
Usage #
Get the latest version from pub:
$ dart pub global activate define_env
Print #
$ dart pub global run define_env # generate dart define string and print it to stdout
You can skip printing using the --no-print
flag
Copy to clipboard #
$ dart pub global run define_env -c # generate dart define string and copy to clipboard
Copy to IDE #
Note
- When copying to IDE config,
define_env
tries to preserve existing arguments and overwrites only the dart-define statements. This is not thoroughly tested and if you face problems with additional arguments please create an issue.
VS Code launch.json
$ dart pub global run define_env -l # generate dart define string and copy it to launch.json
By default, all configurations in launch.json
are updated. If you want to update only a specific
configuration, you can do the following
$ dart pub global run define_env -l -n staging # generate dart define string and copy it to "staging" configuration in launch.json
Note
launch.json
may sometimes contain comments. These comments cannot be preserved as of now. If this is important then you should avoid this package
Android Studio
$ dart pub global run define_env -a # generate dart define string and copy it to all run configs
By default, all configurations in .idea/workspace.xml
and .run/
are updated. If you want to update only a specific
configuration, you can do the following
$ dart pub global run define_env -a -n staging # generate dart define string and copy it to "staging" configuration only
Discussion #
Use the issue tracker for bug reports and feature requests.
Roadmap #
- ✅ Add support for Android Studio and Intellij.
- ❌ Make Android Studio and VS Code extensions and plugins to update config automatically when
.env
files are updated. - ❌ Generate
Config
class from.env
files which extract values from environment. - ❌ Copy config name directly from
.env
files. ex.env.staging
is copied to staging config. - ❌ Add validation support against
.env.example
to see warn if any environment variable is missing. - ❌ Simplify command usage. ex
define_env:print
define_env:copy
define_env:vscode
etc.