Skip to main content
The recommended way to configure Portrix in your application is through environment variables. Externalizing credentials and configuration from your source code keeps secrets out of version control, makes it easy to switch between environments (development, staging, production), and follows security best practices.

Core variables

Never commit .env files containing real API keys to version control. Add .env to your .gitignore immediately after creating it.

Setting variables

Add the following lines to your shell profile (~/.zshrc, ~/.bashrc, or ~/.bash_profile) to make the variables available in every terminal session:
After editing the file, reload your shell:
To set a variable only for the current terminal session (without persisting it), run the export commands directly in your terminal.

Loading in Python

Use the built-in os module to read environment variables, and python-dotenv to load a .env file during local development.

Loading in Node.js

Use process.env to access variables and the dotenv package to load a .env file.

CI/CD

Keep secrets out of your code and CI configuration files by using your platform’s native secret management:

GitHub Actions

Store your API key in Settings > Secrets and variables > Actions as a repository secret named PORTRIX_API_KEY. Reference it in your workflow:

Vercel

Add PORTRIX_API_KEY under Project Settings > Environment Variables in the Vercel dashboard. Select which environments (Production, Preview, Development) should receive the variable. Vercel injects it automatically at build and runtime.
For other platforms (Railway, Render, AWS, GCP, Azure), use the equivalent secrets or environment configuration feature — the variable names remain the same regardless of platform.