#env-var #configuration #environment #settings #sane #variables #manage

app activate

A sane way to manage environment-specific configurations

3 releases (breaking)

0.3.0 Feb 10, 2024
0.2.0 Feb 9, 2024
0.1.0 Feb 6, 2024

#58 in Configuration

MIT license

332 lines


crates.io License: MIT Build Status

A sane way to manage environment-specific configurations. Simplify the way you work and build across various settings like Development, Testing, Production, and more.

Problem Statement

Code in different environments such as Dev, QA, Prod, etc. may need various configurations to run. The solution often used is loading environment variables or property files at build or run time. This by itself has a few drawbacks:

  • Setting up environments may take some additional imperative configuration or worse user setup.
  • Switching between environments is tedious.
  • Developers may have to maintain custom implementations and build scripts.
  • No good solution exists for switching entire mono-repos between environments.


activate solves all these problems.

  • Create an active.toml file and declaratively define your environments.
  • Loading and unloading an environment is as easy as activate <name> and deactivate with just activate.
  • No custom build scripts necessary, have per environment managed files/directories and environment variables.
  • Switch an entire mono-repo with activate -r <name>, all directories containing activate.toml are switched to <name>.

Example Use Cases

  1. You have assets, data files, executables, or program files that should be used in different environments like Dev, QA, etc. e.g.

    "app/data" = "path/to/dev/data"
    "app/data" = "path/to/qa/data"

    app/data is created and symlinked to the file or directory of the active environment.

  2. You want different environment variables in each environment e.g.

    HOST = "localhost"
    PORT = 3000
    HOST = ""
    PORT = 443

    To load into your current shell run (this will also unload any activate environment).

    eval "$(activate -e <name>)"`

    Alternatively you can load the active .env file yourself or from an application, located at .activate/.env. This can also be useful for dev containers. Just add "runArgs": ["--env-file",".activate/.env"] to your .devcontainer/devcontainer.json file.

  3. You are using a mono-repo and want to switch everything to a certain environment. Run:

    activate -r <name>

    any directory/subdirecory (respecting .gitignore) with an activate.toml file is switched to <name>

activate.toml Schema




cargo install activate


  • Allow activating multiple environments at the same time
  • Allow specifying environment entering and leaving scripts
  • Add defualt environment and shell hook


~145K SLoC