Package: dotem
dotemdotem is a simple Python package designed to streamline the process of loading environment variables into your shell from a.env.tomlfile. It aims to make the configuration of your development environment easier and more consistent.MotivationManaging environment variables is a common task in software development, and it can become cumbersome, especially when dealing with multiple configurations for different environments.An example of a project with many different.envfiles:project/
|-- env/
|   |-- .env
|   |-- .env.local
|   |-- .env.development
|   |-- .env.staging
|   |-- .env.uat
|   |-- .env.prod
|   `-- ...
`-- ...dotem was created with the following motivations:Simplicity: Provide a straightforward solution for loading environment variables, reducing the complexity of managing configurations using a single file.env.toml.Consistency: Establish a consistent approach to handling environment variables across projects, using a standardized.env.tomlfile format.Ease of Use: Make it easy for developers to "source" their environment variables in a single command call.Installation[!WARNING]dotemis supported in Linux and Darwin machines only!You can installdotemusing pip. Run the following command:pipinstalldotemThen, in your.bashrcor.zshrcfile, add the following line:eval"$("dotem-cli"hook)"FeaturesLoading and unloading environment variables from a.env.tomlfile.Simple and lightweight.Support TOML format for easy configuration.Loading and unloading environment variables with inheritance.UsageCreate a.env.tomlfile with your environment variables.[development]API_KEY="..."DATABASE_URL="..."[production]API_KEY="..."DATABASE_URL="..."In your shell, usedotem load [profile]to load the environment variable into your shell.dotemloaddevelopmentThis will load the environment variables of that profile in your shell.Commandsdotem load [profile]- Loads the environment variables defined in the profile.dotem unload [profle]- Unsets the environment variables defined in the profile.dotem edit- Edits the.env.tomlfile in the$EDITORdotem hook- A script to hook updotemdotem --help- Helpdotem [COMMAND] --help- Command helpConfiguration.env.tomlsearch pathBy default,dotemwill look for the.env.tomlfile in the current working directory. If there are no.env.tomlin the current working directory, it will check in the following order:Current working directory (./env.toml).Parent directory (../.env.toml)$XDG_CONFIG_HOME/.config/dotem/.env.tomlor$HOME/.config/dotem/.env.tomlif$XDG_CONFIG_HOMEis not defined.$HOME/.env.tomlDefault profilesThe[global]profileTheglobalprofile is a profile that always gets loaded whenever you calldotem load [profile].The[default]profileIf the profile indotem load [profile]is empty, dotem will load thedefaultprofile. If adefaultprofile is not set, it will raise an error.Environment variable inheritancedotemsupports environment variable inheritance. Suppose we have the following.env.tomlfile:[development]API_KEY="..."DATABASE_URL="..."[development.zone-a]ZONE_A_SECRET_USERNAME="..."ZONE_A_SECRET_PASSWORD="..."[development.zone-b]ZONE_B_SECRET_USERNAME="..."ZONE_B_SECRET_PASSWORD="..."Running the commanddotem load development.zone-awill load the parent's environment variablesdevelopmentand the childzone-a:API_KEY = "..."DATABASE_URL = "..."ZONE_A_SECRET_USERNAME = "..."ZONE_A_SECRET_PASSWORD = "..."[!NOTE]If two of the same environment variable is set in the parent and child profile, dotem will use the environment variable set in the child's profile instead.ContributingContributions, issues, and feature requests are welcome! Please feel free to submit a pull request or open an issue.LicenseThis project is licensed under the MIT License - see theLICENSEfile for details.