{"id":20240337,"url":"https://github.com/waj/shell-secrets","last_synced_at":"2025-09-10T20:45:36.310Z","repository":{"id":46153424,"uuid":"239537272","full_name":"waj/shell-secrets","owner":"waj","description":"Encrypted environment variables","archived":false,"fork":false,"pushed_at":"2021-11-10T20:40:22.000Z","size":3,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-24T15:14:30.917Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","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/waj.png","metadata":{"files":{"readme":"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}},"created_at":"2020-02-10T14:54:33.000Z","updated_at":"2024-08-19T13:33:21.000Z","dependencies_parsed_at":"2022-08-28T07:00:54.731Z","dependency_job_id":null,"html_url":"https://github.com/waj/shell-secrets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waj%2Fshell-secrets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waj%2Fshell-secrets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waj%2Fshell-secrets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/waj%2Fshell-secrets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/waj","download_url":"https://codeload.github.com/waj/shell-secrets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244188335,"owners_count":20412977,"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":[],"created_at":"2024-11-14T08:45:19.919Z","updated_at":"2025-03-18T08:42:54.722Z","avatar_url":"https://github.com/waj.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# shell-secrets\n\nThis is a small tool to set environment variables from encrypted (with GPG) files\n\n![shell-secrets](https://user-images.githubusercontent.com/22697/74163644-6e741100-4c01-11ea-8c10-41c53d21eba0.gif)\n\nThere are many command line tools that require environment variables with secret values to work.\nThese values are often saved in unencrypted shell files. I created this simple but useful script\nto read secret values from encrypted files and at the same time make it easy to login in and out\nfrom diferent accounts.\n\n## Installation\n\n**NOTICE**: GPG is assumed to be installed and configured for the current user.\n\nCopy the `shell-secrets.sh` file anywhere in your disk. Add the following line in your profile shell script:\n\n```\nsource /path/to/shell-secrets.sh\n```\n\nAlso is recommended to modify the shell prompt to display the current login. For example this\ncan be inserted in your `PS1` variable:\n\n```\nexport PS1='... \\e[31m$SECRET_LOGIN\\e[0m ...'\n```\n\nThe variable `$SECRET_LOGIN` keeps the list of account names being used in the current shell.\n\n## Usage\n\n### Create secret files\n\nFirst, make sure the `~/.shell-secrets/` directory exists. This is where encrypted files will be stored:\n\n```\nmkdir -p ~/.shell-secrets\n```\n\nNow create new encrypted files using GPG:\n\n```\n$ gpg --encrypt -r yourself@some.email.com --armor --output ~/.shell-secrets/foo.gpg\nexport FOO=E9yyQ7MApwoQHXBCIs7or5aQ9W\nexport BAR=lLvxSCbY4j+Kdn\n...\n^D\n```\n\nDone!\n\n### Login\n\nTo login using any of the encrypted files, just call the `login` function with the file name (without the `.gpg` extension)\n\n```\n$ login foo\nfoo $ env\n...\nFOO=E9yyQ7MApwoQHXBCIs7or5aQ9W\nBAR=lLvxSCbY4j+Kdn\n...\n```\n\nThe enviroment variables are set and ready to be used and the `SECRET_LOGIN` environment variable is updated to be used by the prompt. The script also includes autocomplete for the\navailable file names in the `.shell-secrets` directory.\n\nSeveral logins can also be nested:\n\n```\n$ login foo\nfoo $ login bar\nfoo bar $\n```\n\n### Logout\n\nEvery time the `login` function is used, a new sub-shell process is created. To logout from the current\naccount, call `logout` or just press `Ctrl+D`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaj%2Fshell-secrets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwaj%2Fshell-secrets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwaj%2Fshell-secrets/lists"}