Environment variables
Expose environment variables prefixed with PORTMAN_ as camelCase Postman variables, from your shell or a spec-specific .env file.
Portman turns any environment variable that starts with PORTMAN_ into a Postman variable with the camel-cased name, so secrets and per-environment values never have to live in your OpenAPI spec or Portman config.
The PORTMAN_ prefix
Portman uses dotenv to read environment variables. Prefix a variable with PORTMAN_:
PORTMAN_CONSUMER_ID=test_user_idIt becomes available in your collection and tests as the camel-cased equivalent:
{{consumerId}}By default, Portman uses any environment variable starting with PORTMAN_ that is defined in the environment, so you can also set them in your shell or CI job.
Using a .env file
Copy .env.example to .env and add the variables you need in your collection.
For a spec-specific .env file that lives next to your config files, pass its path with --envFile:
portman -l ./crm.openapi.yml -c ./portman-config.json --envFile ./crm.envThis is useful when Portman manages multiple specs that each have unique environment requirements.
Do not commit a .env file to version control if it contains confidential credentials.
Collection variables in config
Another way to set variables is through collectionVariables in the globals section of your Portman configuration:
{ "version": 1.0, "globals": { "collectionVariables": { "name": "portman", "version": "1" } }}Postman API variables
The .env file is also where Portman reads POSTMAN_API_KEY, POSTMAN_WORKSPACE_NAME and POSTMAN_COLLECTION_UID for uploads. These are not prefixed with PORTMAN_. See Postman sync.