{"id":27320307,"url":"https://github.com/mcmah309/activate","last_synced_at":"2025-04-12T09:46:37.993Z","repository":{"id":221379495,"uuid":"753839323","full_name":"mcmah309/activate","owner":"mcmah309","description":"A tool to manage environment-specific configurations. Simplifying working across various settings like Development, Testing, Production, etc.","archived":false,"fork":false,"pushed_at":"2024-11-26T21:34:56.000Z","size":122,"stargazers_count":4,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T06:02:25.117Z","etag":null,"topics":["cli","environments","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcmah309.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-06T22:10:35.000Z","updated_at":"2024-11-26T19:42:25.000Z","dependencies_parsed_at":"2024-11-26T15:38:19.247Z","dependency_job_id":null,"html_url":"https://github.com/mcmah309/activate","commit_stats":null,"previous_names":["mcmah309/activate"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmah309%2Factivate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmah309%2Factivate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmah309%2Factivate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcmah309%2Factivate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcmah309","download_url":"https://codeload.github.com/mcmah309/activate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248550628,"owners_count":21122930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","environments","rust"],"created_at":"2025-04-12T09:46:37.190Z","updated_at":"2025-04-12T09:46:37.982Z","avatar_url":"https://github.com/mcmah309.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# activate\n\n[![crates.io](https://img.shields.io/crates/v/activate)](https://crates.io/crates/activate)\n[![License: MIT](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT)\n[![Build Status](https://github.com/mcmah309/activate/actions/workflows/rust.yml/badge.svg)](https://github.com/mcmah309/activate/actions)\n\nA tool to manage environment-specific configurations. Simplifying working across various settings like Development, Testing, Production, etc.\n\n## Motivation\n### Problem Statement\nCode in different environments such as Dev, QA, Prod, etc. may need various configurations to run. \nThe solution often used is loading environment variables or property files at build or run time.\nThis by itself has a few drawbacks:\n- Setting up environments may take some additional imperative configuration, or worse, manual developer setup.\n- Switching between environments is tedious.\n- Developers may have to maintain custom implementations and build scripts.\n- No good solution exists for switching entire monorepos between environments. Instead, a master config is often used.\n\n### Solution\n`activate` solves all these problems.\n- An `active.toml` file declaratively defines environments.\n- Loading and unloading an environment is as easy as a single command.\n- No custom build scripts necessary. Each environment has managed files/directories and environment variables.\n- The config can be distributed throughout a repo and everything switched with a single command.\n\n## More Details\n\n### Files and Directories\nDifferent environments like Dev, QA, etc. may have assets, data files, executables, or program files that should be used\nin each. All of these can be switched over at once. e.g.\n```toml\n[dev.links]\n\"app/data\" = \"path/to/dev/data\"\n\n[qa.links]\n\"app/data\" = \"path/to/qa/data\"\n```\nThe result of the above is `app/data` is created and symlinked to the file or directory of the active environment.\n\n### Env Variables\nOften each environment has specific environment variables. This can be easily defined.\ne.g.\n```toml\n[dev.env]\nHOST = \"localhost\"\nPORT = 3000\n\n[qa.env]\nHOST = \"178.32.44.2\"\nPORT = 443\n```\nTo load an environment into the current shell, and unload any activate environment, run\n```bash\neval \"$(activate \u003cname\u003e)\"`\n```\nConsider adding the following to `~/.bashrc` as a shortcut\n```bash\na() {\n    eval \"$(activate \"$@\")\";\n}\n```\nThen environments can be easily loaded with an even shorter command\n```bash\na dev\n```\n\n\u003e `.env`, `configmap`, `env.json` and files, representing the active environment,\n\u003e are also created in the `.activate/active` directory for convenient use.\n\n### Monorepo\n`activate.toml` files can be distributed across a codebase, where each application has its own\n`activate.toml` file. From the root of the repo everything can be switched together with the `-d`\nflag. e.g.\n```bash\nactivate -d \u003cname\u003e\n```\nAny directory/subdirectory (respecting `.gitignore`) with an `activate.toml` file is switched to `\u003cname\u003e`.\n\n## `activate.toml` Schema\n```\n[\u003cENV_NAME\u003e.env]\n\u003cENV_VAR_NAME\u003e = \u003cENV_VAR_VALUE\u003e\n\n[\u003cENV_NAME\u003e.links]\n\"\u003cLINK_PATH_FROM_ROOT\u003e\" = \"\u003cSOURCE_PATH_FROM_ROOT\u003e\"\n```\n\n## Install\n\n## Debian - Ubuntu, Linux Mint, Pop!_OS, etc.\n\n```bash\nrelease_ver=\u003cINSERT_CURRENT_VERSION\u003e # e.g. release_ver='v0.5.0'\ndeb_file=\"activate_$(echo $release_ver | sed 's/^v//')-1_amd64.deb\"\ncurl -LO https://github.com/mcmah309/activate/releases/download/$release_ver/$deb_file\ndpkg -i \"$deb_file\"\n```\n\n## Cargo\n```bash\ncargo install activate\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmah309%2Factivate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcmah309%2Factivate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcmah309%2Factivate/lists"}