### Installation Source: https://github.com/dotenv-org/cli/blob/master/README.md Instructions for installing the dotenv-cli globally or locally. ```APIDOC ## Installation ```bash # install globally (recommended) npm install @dotenv/cli -g # optionally run with sudo npm install @dotenv/cli -g ``` or ```bash # install locally npm install @dotenv/cli --save-dev ``` ``` -------------------------------- ### Install Dependencies and Run Tests Source: https://github.com/dotenv-org/cli/blob/master/CONTRIBUTING.md Use these commands to install project dependencies and run the test suite. ```bash npm install npm test ``` -------------------------------- ### Setup Dotenv Project with Credentials Source: https://context7.com/dotenv-org/cli/llms.txt The `dotenv-cli setup` command configures `.env`, `.env.project`, and `.env.me` files using provided credentials. This is beneficial for automated environments like CI/CD or for onboarding new team members. ```bash $ dotenv-cli setup prj_abc123def456 me_xyz789uvw012 # Output: # local: # local: Creating .env # local: Creating .env.project # local: Creating .env.me # local: # Setup complete. # # Try running `dotenv-cli push` next. # The command creates the following files: # .env -> HELLO=world (if not existing) # .env.project -> DOTENV_PROJECT=prj_abc123def456 # .env.me -> DOTENV_ME=me_xyz789uvw012 ``` -------------------------------- ### Install dotenv-cli Globally Source: https://github.com/dotenv-org/cli/blob/master/README.md Install the dotenv-cli globally for system-wide access. This is the recommended installation method. You may need to use sudo depending on your npm configuration. ```bash npm install @dotenv/cli -g # optionally run with sudo npm install @dotenv/cli -g ``` -------------------------------- ### Usage Source: https://github.com/dotenv-org/cli/blob/master/README.md Basic usage examples for the dotenv-cli. ```APIDOC ## Usage Usage is easy! Run the command: ```bash dotenv-cli new ``` Follow those instructions and then run: ```bash dotenv-cli push ``` And if you need to pull changes that another teammate made, run: ```bash dotenv-cli pull ``` That's it! ``` -------------------------------- ### Install @dotenv/cli Source: https://context7.com/dotenv-org/cli/llms.txt Install the CLI globally for system-wide access or locally as a development dependency in your project. ```bash npm install @dotenv/cli -g ``` ```bash npm install @dotenv/cli --save-dev ``` -------------------------------- ### Example .env.me Configuration Source: https://context7.com/dotenv-org/cli/llms.txt This file stores your personal authentication token and should NEVER be committed to version control. It is used for non-interactive authentication, particularly in CI/CD pipelines. ```bash # .env.me - Personal authentication token (NEVER commit this) DOTENV_ME=me_xyz789uvw012 ``` -------------------------------- ### Initialize New Dotenv Project Source: https://context7.com/dotenv-org/cli/llms.txt Use `dotenv-cli new` to create a new `.env.project` file and initialize your project with Dotenv. Follow the provided URL to create your project on dotenv.org and then use the `setup` command with the obtained credentials. ```bash $ dotenv-cli new # Output: # Visit https://dotenv.org/new to create your project # Then run `dotenv-cli setup ` with the provided credentials ``` -------------------------------- ### Create New .env Project File Source: https://github.com/dotenv-org/cli/blob/master/README.md Use the 'new' command to create a new .env.project file. This command initiates the setup for managing your environment variables. ```bash dotenv-cli new ``` -------------------------------- ### Install dotenv-cli Locally Source: https://github.com/dotenv-org/cli/blob/master/README.md Install the dotenv-cli as a local development dependency for a specific project. ```bash npm install @dotenv/cli --save-dev ``` -------------------------------- ### Get Help for dotenv-cli Commands Source: https://context7.com/dotenv-org/cli/llms.txt Use `dotenv-cli help` to display general help information or specific help for any command, including available options and arguments. The `--all` flag shows all available commands. ```bash # Show general help $ dotenv-cli help # Show help for a specific command $ dotenv-cli help pull # Output: # USAGE # $ dotenv-cli pull [ENVIRONMENT] [FILENAME] # # ARGUMENTS # ENVIRONMENT Pull .env.ci, .env.staging, and .env.production # FILENAME Set output filename. Defaults to .env for development and .env.{environment} for other environments # # OPTIONS # -m, --dotenv_me=dotenv_me pass value for .env.me rather than reading from .env.me file # Show all available commands $ dotenv-cli help --all ``` -------------------------------- ### Example .env.project Configuration Source: https://context7.com/dotenv-org/cli/llms.txt This file contains the project identifier and is safe to commit to version control. It helps the Dotenv CLI associate your environment variables with a specific project. ```bash # .env.project - Project identifier (safe to commit) DOTENV_PROJECT=prj_abc123def456 ``` -------------------------------- ### Display Help for dotenv-cli Source: https://github.com/dotenv-org/cli/blob/master/README.md Display help information for the dotenv-cli. You can specify a COMMAND to get help for a specific command. ```bash dotenv-cli help [COMMAND] # USAGE # $ dotenv-cli help [COMMAND] # # ARGUMENTS # COMMAND command to show help for # # OPTIONS # --all see all commands in CLI ``` -------------------------------- ### Example .env Configuration Source: https://context7.com/dotenv-org/cli/llms.txt This file stores your actual environment variables and is managed by the Dotenv CLI for syncing across team members and environments. Sensitive variables like API keys and secret keys should be listed here. ```bash # .env - Your actual environment variables (pushed/pulled) DATABASE_URL=postgresql://localhost/myapp API_KEY=sk_live_abc123 SECRET_KEY=your_secret_here ``` -------------------------------- ### Example .gitignore Entries Source: https://context7.com/dotenv-org/cli/llms.txt These entries are automatically added to your .gitignore file by the Dotenv CLI to prevent sensitive configuration files from being committed to your repository. ```gitignore # .gitignore entries added automatically: # .env* # !.env.project # !.env.vault ``` -------------------------------- ### Commands Source: https://github.com/dotenv-org/cli/blob/master/README.md Detailed documentation for each command available in the dotenv-cli. ```APIDOC ## Commands ### `dotenv-cli help [COMMAND]` display help for dotenv-cli ``` USAGE $ dotenv-cli help [COMMAND] ARGUMENTS COMMAND command to show help for OPTIONS --all see all commands in CLI ``` ### `dotenv-cli new` Create your `.env.project` file. Example: ```bash $ dotenv-cli new ``` ### `dotenv-cli push [FILENAME]` Push your `.env` file to development environment. Example: ```bash $ dotenv-cli push # pushes local .env to remote development ``` #### Arguments ##### [FILENAME] Set input filename. Defaults to .env. Example: ```bash $ dotenv-cli push .env.development # pushes .env.development to remote development environment ``` #### Options ##### --dotenv_me Directly pass your `DOTENV_ME` value to the command line, instead of reading from a `.env.me` file. Examples: ```bash $ dotenv-cli push .env.development --dotenv_me=me_1234 # pushes local .env.development to remote development ``` ### `dotenv-cli pull [ENVIRONMENT] [FILENAME]` Pulls your development|staging|ci|production environment(s) to your machine. Example: ```bash $ dotenv-cli pull # pulls remote development envs to .env ``` For more information run.. ```bash $ dotenv-cli help pull ``` #### Arguments ##### [ENVIRONMENT] Pull .env.ci, .env.staging, and .env.production Example: ```bash $ dotenv-cli pull staging # pulls remote staging envs to .env.staging ``` ##### [FILENAME] Set output filename. Defaults to .env for development and .env.{environment} for other environments Example: ```bash $ dotenv-cli pull production .env # pulls remote production envs to .env ``` #### Options ##### --dotenv_me Directly pass your `DOTENV_ME` value to the command line, instead of reading from a `.env.me` file. Examples: ```bash $ dotenv-cli pull staging --dotenv_me=me_1234 # pulls remote staging envs to .env.staging $ dotenv-cli pull production .env --dotenv_me=me_1234 # pulls remote production envs to .env ``` ``` -------------------------------- ### Push Local .env to Dotenv Service Source: https://context7.com/dotenv-org/cli/llms.txt Use `dotenv-cli push` to upload your local `.env` file to the Dotenv service. You can push specific environment files or pass credentials directly via flags, which is useful for CI/CD. First-time pushes without a `.env.me` file will trigger email verification. ```bash # Push the default .env file to development environment $ dotenv-cli push # Output: # remote: # remote: Securely pushing .env # remote: # Changes pushed. # Push a specific environment file $ dotenv-cli push .env.development # Output: # remote: # remote: Securely pushing .env.development # remote: # Changes pushed. # Push with credentials passed directly (useful for CI/CD) $ dotenv-cli push .env.staging --dotenv_me=me_1234abcd5678 # Output: # remote: # remote: Securely pushing .env.staging # remote: # Changes pushed. # First-time push without .env.me file triggers email authentication: $ dotenv-cli push # ? What is your email address? developer@example.com # i sending a code. # v sent. check your email. # ? What is the code? 123456 # i verifying that code. # v verified code. # remote: # remote: Securely pushing .env # remote: # Changes pushed. ``` -------------------------------- ### Run Tests Source: https://github.com/dotenv-org/cli/blob/master/README.md Execute the test suite for the dotenv-cli project using yarn. ```bash yarn test ``` -------------------------------- ### Publish to npm Source: https://github.com/dotenv-org/cli/blob/master/README.md Publish the dotenv-cli package to the npm registry. This command is restricted to users with publishing permissions. ```bash npm publish ``` -------------------------------- ### Push with DOTENV_ME Option Source: https://github.com/dotenv-org/cli/blob/master/README.md Push your .env file to the remote environment while directly passing your DOTENV_ME value via the command line. This bypasses the need for a .env.me file. ```bash dotenv-cli push .env.development --dotenv_me=me_1234 # pushes local .env.development to remote development ``` -------------------------------- ### Push Local .env File Source: https://github.com/dotenv-org/cli/blob/master/README.md Push your local .env file to the remote development environment. This command synchronizes your local environment variables with the remote server. ```bash dotenv-cli push # pushes local .env to remote development ``` -------------------------------- ### Push Specific .env File Source: https://github.com/dotenv-org/cli/blob/master/README.md Push a specific .env file to the remote development environment by providing the filename as an argument. This allows you to manage different environment configurations. ```bash dotenv-cli push .env.development # pushes .env.development to remote development environment ``` -------------------------------- ### Pull Environment Variables from Dotenv Service Source: https://context7.com/dotenv-org/cli/llms.txt Use `dotenv-cli pull` to download environment variables from the Dotenv service to your local machine. It supports various environments (development, staging, ci, production) and allows specifying custom output filenames. Credentials can be provided via flags for CI/CD. ```bash # Pull development environment to .env (default) $ dotenv-cli pull # Output: # remote: # remote: Securely pulling .env # remote: # Updated. # # -HELLO=world # +HELLO=World # +API_KEY=sk_test_abc123 # # Done. # Pull staging environment to .env.staging $ dotenv-cli pull staging # Output: # remote: # remote: Securely pulling .env.staging # remote: # Done. # Pull production environment to a custom file $ dotenv-cli pull production .env.local # Output: # remote: # remote: Securely pulling .env.production to .env.local # remote: # Done. # Pull with credentials flag for CI/CD environments $ dotenv-cli pull production --dotenv_me=me_1234abcd5678 # Available environments: # - development (default) -> outputs to .env # - ci -> outputs to .env.ci # - staging -> outputs to .env.staging # - production -> outputs to .env.production ``` -------------------------------- ### Pull Specific Remote Environment Source: https://github.com/dotenv-org/cli/blob/master/README.md Pull a specific remote environment (e.g., staging, ci, production) to your local machine. The output filename defaults to .env.{environment}. ```bash dotenv-cli pull staging # pulls remote staging envs to .env.staging ``` -------------------------------- ### Run dotenv-cli in Development Mode Source: https://github.com/dotenv-org/cli/blob/master/README.md Execute the dotenv-cli using a specific API URL and disabling TLS certificate verification. This is typically used during development to connect to a local or test API endpoint. ```bash NODE_TLS_REJECT_UNAUTHORIZED=0 DOTENV_API_URL=https://cli.dotenv.development ./bin/run ``` -------------------------------- ### Pull with DOTENV_ME Option Source: https://github.com/dotenv-org/cli/blob/master/README.md Pull remote environment variables while directly passing your DOTENV_ME value via the command line. This is an alternative to using a .env.me file. ```bash dotenv-cli pull staging --dotenv_me=me_1234 # pulls remote staging envs to .env.staging ``` ```bash dotenv-cli pull production .env --dotenv_me=me_1234 # pulls remote production envs to .env ``` -------------------------------- ### Pull Remote Environments to Local Source: https://github.com/dotenv-org/cli/blob/master/README.md Pull remote environment variables to your local machine. By default, this command pulls the remote development environment and saves it as a .env file. ```bash dotenv-cli pull # pulls remote development envs to .env ``` -------------------------------- ### Pull Remote Environment to Specific Output File Source: https://github.com/dotenv-org/cli/blob/master/README.md Pull a remote environment's variables and save them to a specified output filename. This is useful for custom configurations or when you don't want to overwrite the default .env file. ```bash dotenv-cli pull production .env # pulls remote production envs to .env ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.