Skip to content

Base Setup

Credentials

Managing sensitive information like passwords and API keys securely is crucial.

  • All password/credentials/access data is stored in an .env file located within a config/ folder.
  • This config/ folder (and specifically the .env file) should be included in your project’s .gitignore file to prevent accidental commits to version control.
    .gitignore example
    # Ignore sensitive config files
    config/.env
  • Credentials are loaded into the application environment at runtime using the dotenv library (or similar).
  • Rationale for .env: While environment variables are standard, using an .env file allows credentials to be easily managed and shared across different development machines if needed (though care must be taken).
  • ENV_PATH Variable: To avoid issues with relative paths when locating the .env file, the application requires an environment variable named ENV_PATH to be set. This variable must contain the absolute path to your .env file.
    Example (.bashrc / .zshrc)
    export ENV_PATH="/path/to/your/project/config/.env"
  • The application reads the ENV_PATH variable to know exactly where to find and load the .env file using dotenv.