https://github.com/gyf304/dotenv Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} gyf304 / dotenv Public * Notifications * Fork 0 * Star 28 * Standalone, language agnostic dotenv License View license 28 stars 0 forks Branches Tags Activity Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights gyf304/dotenv This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Name Name Last commit Last commit message date Latest commit History 9 Commits .github/workflows .github/ workflows .gitignore .gitignore LICENSE LICENSE Makefile Makefile README.md README.md README.pre.md README.pre.md dotenv.1 dotenv.1 dotenv.c dotenv.c View all files Repository files navigation * README * License Prefix any command with dotenv to load environment variables from a file named .env in the current directory. dotenv sh -c 'echo $MY_VAR' Alternatively put dotenv in the shebang line of a script to automatically load environment variables. #!/usr/bin/env -S dotenv bash echo $MY_VAR dotenv is a tiny, self-contained utility. This README file contains the installation instructions and the manpage for the dotenv utility. INSTALL dotenv can be installed on a Unix-like system with a C compiler and make installed by running the following commands: make sudo make install This will install the dotenv binary to /usr/local/bin, and the manpage to /usr/local/share/man/man1. DOTENV(1) - General Commands Manual NAME dotenv - load environment variables from a file SYNOPSIS dotenv program ... DESCRIPTION The dotenv utility reads a file (by default .env in the current directory) and loads the environment variables from it. It then executes the specified program with the loaded environment variables. If no dotenv file is found, it will execute the program with the current environment. ENVIRONMENT VARIABLES DOTENV_PATH The path to the dotenv file. If not set, the default path is .env in the current directory. DOTENV_CONFIG_PATH Same as DOTENV_PATH for compatibility with the original nodejs dotenv implementation. EXAMPLES Run the env(1) command with the environment variables loaded from the .env file in the current directory: $ dotenv env Same as above but with a custom dotenv file path: $ DOTENV_PATH=.env2 dotenv env Use dotenv in the shebang line of a script: #!/usr/bin/env -S dotenv bash echo $MY_VAR FILE FORMAT The file format is a list of key-value pairs, one per line. The key and value are separated by an equal sign. Whitespaces around keys and values are ignored. A line is terminated by a newline character or a carriage return. Comments can be added using a hash sign (#) either at the start of a line or inline. For values that contain a hash sign, the value must be quoted. Values can be optionally quoted with single or double quotes. If quoted, the following escape sequences are supported: \n A newline. \r A carriage return. \t A tab. \' A single quote. \" A double quote. \\ A backslash. SEE ALSO env(1) AUTHORS Yifan Gu Unknown OS - April 28, 2024 About Standalone, language agnostic dotenv Resources Readme License View license Activity Stars 28 stars Watchers 1 watching Forks 0 forks Report repository Releases No releases published Packages 0 No packages published Languages * C 55.4% * Roff 28.7% * Makefile 15.9% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.