{"id":19498154,"url":"https://github.com/patrickalphac/creating-environment-variables","last_synced_at":"2026-06-19T14:32:22.194Z","repository":{"id":104132766,"uuid":"356988597","full_name":"PatrickAlphaC/creating-environment-variables","owner":"PatrickAlphaC","description":null,"archived":false,"fork":false,"pushed_at":"2021-04-11T21:59:46.000Z","size":12,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-18T14:37:33.113Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/PatrickAlphaC.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-04-11T21:59:20.000Z","updated_at":"2021-09-26T01:48:41.000Z","dependencies_parsed_at":"2025-11-18T14:36:30.142Z","dependency_job_id":null,"html_url":"https://github.com/PatrickAlphaC/creating-environment-variables","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/PatrickAlphaC/creating-environment-variables","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fcreating-environment-variables","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fcreating-environment-variables/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fcreating-environment-variables/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fcreating-environment-variables/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PatrickAlphaC","download_url":"https://codeload.github.com/PatrickAlphaC/creating-environment-variables/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatrickAlphaC%2Fcreating-environment-variables/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34536275,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-10T21:49:23.111Z","updated_at":"2026-06-19T14:32:22.187Z","avatar_url":"https://github.com/PatrickAlphaC.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Creating Environment Variables\n\nThere are 3 ways we will talk about creating and working with environment variables:\n\n*note: shell and terminal are used interchably*\n\n- [Creating Environment Variables](#creating-environment-variables)\n  - [Through your shell](#through-your-shell)\n  - [With a shell configuration file](#with-a-shell-configuration-file)\n  - [With a `.env` file](#with-a-env-file)\n    - [Python](#python)\n    - [Nodejs](#nodejs)\n\n## Through your shell\n\nYou can create an environment variable by running:\n\n```bash\nexport DOG=PUG\n```\n\nAnd then check to see if you've done it right with:\n\n```bash\necho $DOG\n```\nAnd you should see the shell print out `PUG`.\n\nCreating environment variables this way mean that when you close your terminal/shell, you will lose all environment variables.\n\n## With a shell configuration file\n\nIf you use environment variables a lot, a better way might be to put them in a [shell configuration file](https://www.computerworld.com/article/2786076/shell-configuration-files.html). \n\nFor example, if you use Bash, you might have a file like `~/.bash_profile` that has the following in it:\n\n```bash\nexport DOG=PUG\n```\n\nThis will mean, that every time your user starts up a shell, that environment variable will be set. \n\nFor a shell like `zsh` or `z shell` you can do the same in the `~/.zshenv` file\n\n## With a `.env` file\n\nSometimes, you want to separate environment variables project to project, so at the home directory of your project, you put all your environment variables in a `.env` file. You'll then have to load those `.env` files into your files specifically. We have a python and nodejs example in this repo.\n\nIf your shell already has environment variables, the environment variables in the `.env` will *not* override the ones in your shell. \n\n### Python\n\n```\nfrom dotenv import load_dotenv\nload_dotenv()\n```\n\n### Nodejs\n\n```\nrequire('dotenv').config()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickalphac%2Fcreating-environment-variables","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickalphac%2Fcreating-environment-variables","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickalphac%2Fcreating-environment-variables/lists"}