{"id":17869463,"url":"https://github.com/fabberr/setenv","last_synced_at":"2025-04-02T22:44:00.788Z","repository":{"id":259645354,"uuid":"879117147","full_name":"fabberr/setenv","owner":"fabberr","description":"Export environment variables from file.","archived":false,"fork":false,"pushed_at":"2024-10-27T07:23:28.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-08T13:14:59.082Z","etag":null,"topics":["bash-script","environment-variables","shell-script"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fabberr.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-27T02:57:55.000Z","updated_at":"2024-10-27T07:23:31.000Z","dependencies_parsed_at":"2024-10-27T04:27:59.924Z","dependency_job_id":null,"html_url":"https://github.com/fabberr/setenv","commit_stats":null,"previous_names":["fabberr/setenv"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabberr%2Fsetenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabberr%2Fsetenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabberr%2Fsetenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fabberr%2Fsetenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fabberr","download_url":"https://codeload.github.com/fabberr/setenv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246905830,"owners_count":20852818,"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":["bash-script","environment-variables","shell-script"],"created_at":"2024-10-28T10:05:45.449Z","updated_at":"2025-04-02T22:44:00.766Z","avatar_url":"https://github.com/fabberr.png","language":"Shell","readme":"# setenv\n\nExport environment variables from file.\n\n## Description\n\nUtility shell script for loading environment variables defined in `.env` files, with support for automatic expansion of relative paths into absolute paths.\n\n## Dependencies\n\nCurrently the script is only available for command line interpreters compatible with [`bash`](https://www.gnu.org/software/bash/) syntax.\n\nTested with `bash` on Linux, but should work out of the box on any UNIX-like operating system on a variety of shells.\n\n## Usage\n\nThis script was **not** designed to be invoked directly, instead use the [`source`](https://www.gnu.org/software/bash/manual/html_node/Bash-Builtins.html#index-source) builtin command to ensure the variables are [exported](https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html#index-export) into the current shell session instead of just the script's subshell.\nBecause of this design, the script file doesn't need execute permissions, and uses `return` statements instead of `exit` for implementing control flow.\n\nTo load the variables, simply invoke the script through the `source` command in the same directory the `.env` file is located. If no `\u003cfilename\u003e` is given, it defaults to a `dev.env` file located in the current directory. The file must exist.\n\n```sh\n# Load variables from `dev.env`\nsource setenv.sh [options]\n\n# Load variables from \u003cfilename\u003e\nsource setenv.sh [options] \u003cfilename\u003e\n```\n\nFor the full documentation, see the script source file.\n\n## Installing\n\nThe recommended way to install the script is to clone the repo locally, copy the scrip to a separate directory, then create an [alias](https://www.gnu.org/software/bash/manual/html_node/Aliases.html) for the script with the `source` command already added.\n\n```sh\n# 1. Clone the repository\nSETENV_REPO=\"./scripts/setenv\"\ngit clone git@github.com:fabberr/setenv.git $SETENV_REPO\n\n# 2. Install\nSETENV_ROOT=\"./dev-tools\"\nmkdir -p $SETENV_ROOT \u0026\u0026 cd $SETENV_ROOT\ncp \"$SETENV_REPO/src/setenv.sh\" .\n\n# 3. Register alias\necho \"alias 'setenv'='source $(realpath setenv.sh)'\" \u003e\u003e ~/.bash_aliases\nsource ~/.bash_aliases\n```\n\n## Updating\n\nTo update the script, pull any changes from `origin/master` into your local repo and repeat only step 2 of the installation process.\n\n```sh\n# Pull changes from origin\ngit switch master\ngit pull origin master\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabberr%2Fsetenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffabberr%2Fsetenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffabberr%2Fsetenv/lists"}