{"id":16165976,"url":"https://github.com/luisnquin/senv","last_synced_at":"2026-03-01T19:31:21.801Z","repository":{"id":177961165,"uuid":"660800504","full_name":"luisnquin/senv","owner":"luisnquin","description":"Switch your .env file from the command line","archived":false,"fork":false,"pushed_at":"2025-02-17T16:29:42.000Z","size":114,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T15:51:26.757Z","etag":null,"topics":["cli","dotenv","env","productivity","switcher"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luisnquin.png","metadata":{"files":{"readme":".github/README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2023-06-30T22:08:19.000Z","updated_at":"2025-02-17T16:29:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f5b2cc3-6cf5-47ff-a3a9-095e923a8d44","html_url":"https://github.com/luisnquin/senv","commit_stats":null,"previous_names":["luisnquin/senv"],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/luisnquin/senv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisnquin%2Fsenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisnquin%2Fsenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisnquin%2Fsenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisnquin%2Fsenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luisnquin","download_url":"https://codeload.github.com/luisnquin/senv/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luisnquin%2Fsenv/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29981413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T16:35:47.903Z","status":"ssl_error","status_checked_at":"2026-03-01T16:35:44.899Z","response_time":124,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","dotenv","env","productivity","switcher"],"created_at":"2024-10-10T02:52:46.964Z","updated_at":"2026-03-01T19:31:21.783Z","avatar_url":"https://github.com/luisnquin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Senv\n\n![go-ci](https://github.com/luisnquin/senv/actions/workflows/go.yml/badge.svg)\n\u003cimg alt=\"built-with-nix\" src=\"https://builtwithnix.org/badge.svg\" width=\"80px\"\u003e\n\n## Why?\n\nIt's annoying to have to manually update each **environment variable** or rename **.env** files in order to change to specific configurations for a project.\nThe problem is multiplied if you are working on more than a single project at the same time so the idea here is to have a **senv.yaml** in each one of your\nprojects when you think that you're dealing with multiple **.env** settings.\n\nYou can call the program in any subdirectory of your project and the program will automatically find the **senv.yaml**.\n\nIt's highly inspired by [VSCode - .ENV Switcher](https://marketplace.visualstudio.com/items?itemName=EcksDy.env-switcher) but only deals with a single\nconfiguration file and can be called directly from the command line.\n\n## Demo\n\n[![demo](https://asciinema.org/a/eZrIbb4eDxX0tO7fWyFop2Zg8.svg)](https://asciinema.org/a/eZrIbb4eDxX0tO7fWyFop2Zg8)\n\n## Install\n\n### Via Go\n\n```bash\n# Requires go \u003e=1.18\n$ go install github.com/luisnquin/senv@latest\n```\n\n### Via Nix flakes\n\n\u003cdetails\u003e\n\u003csummary\u003eCode snippet\u003c/summary\u003e\n\n```nix\n{\n  inputs = {\n    senv.url = \"github:luisnquin/senv\";\n  };\n\n  outputs = inputs @ {\n    senv,\n    ...\n  }: let\n    system = \"x86_64-linux\";\n\n    specialArgs = {\n      senv-switcher = senv.defaultPackage.${system};\n    };\n  in {\n    # Home manager\n    homeConfigurations.\"...\" = home-manager.lib.homeManagerConfiguration {\n      extraSpecialArgs = specialArgs;\n\n      modules = [\n        # add \"senv-switcher\" to your home.packages\n        ./home.nix\n      ];\n    };\n\n    # Or NixOS configuration\n    nixosConfigurations.\"...\" = lib.nixosSystem {\n        specialArgs = specialArgs;\n\n        modules = [\n          # add \"senv-switcher\" to your environment.systemPackages\n          ./configuration.nix\n        ];\n      };\n    };\n}\n\n```\n\n\u003c/details\u003e\n\n## Try it with Nix ❄️\n\n\u003cdetails\u003e\n\u003csummary\u003eNix commands\u003c/summary\u003e\n\n```bash\n# Creates a senv.yaml file in your current folder\n$ nix run github:luisnquin/senv -- init\n\n# Lists your declared environments\n$ nix run github:luisnquin/senv -- ls\n\n# Run a prompt that allows you to select an environment\n$ nix run github:luisnquin/senv\n\n# Help\n$ nix run github:luisnquin/senv -- --help\n```\n\n\u003c/details\u003e\n\n## Settings file\n\nThe program requires a **senv.yaml** or **senv.yml** file and you can call the program in any subdirectory of the project.\n\n### Example\n\nSuppose we have a **senv.yaml** file like this:\n\n```yaml\n# senv.yaml\n# absolute/relative(preferably relative) path to target .env file\nenv_file: ./app/.env\nenvs:\n- name: dev\n  variables:\n    DATABASE_USER: admin\n    DATABASE_PASSWORD: pwd123\n    DATABASE_HOST: localhost\n- name: dev-2\n  variables:\n    DATABASE_USER: admin\n    DATABASE_PASSWORD: pwd321\n    DATABASE_HOST: test-host\n- name: prod\n  variables:\n    DATABASE_USER: admin\n    DATABASE_PASSWORD: test-password\n    DATABASE_HOST: test-host\n- name: preprod\n  variables:\n    DATABASE_PASSWORD: root123\n    DATABASE_HOST: localhost\nglobal_variables:\n  DATABASE_USER: admin # both variables will be added to the\n  DATABASE_PORT: 5432 # selected environment if not declared\nuse_export_prefix: false # optional\n```\n\nWhen the .env file is generated from **preprod** it will look like this:\n\n```bash\n#_preprod_#\n\nDATABASE_PASSWORD=\"root123\"\nDATABASE_HOST=\"localhost\"\nDATABASE_USER=\"admin\"\nDATABASE_PORT=\"5432\"\n```\n\n## Completions\n\n### Supported shells\n\n- zsh\n\n```bash\n # Add this line to your .zshrc file\n $ source \u003c(senv completion zsh)\n```\n\n- bash\n\n```bash\n # Add this line to your .bashrc file\n  $ source \u003c(senv completion bash)\n```\n\n## Integrations\n\n### [Starship](https://starship.rs/)\n\n```toml\n# starship.toml\nformat = \"${custom.environment_name}\" # more...\n\n[custom.environment_name]\ncommand = \"senv --get\"\ndescription = \"Displays the name of your current senv environment\"\nformat = \"using [($output )]($style)\"\nshell = [\"bash\", \"--noprofile\", \"--norc\"]\nstyle = \"#a8e046\"\nwhen = \"senv out\"\n```\n\n## LICENSE\n\n[MIT](../LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluisnquin%2Fsenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluisnquin%2Fsenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluisnquin%2Fsenv/lists"}