Environment Variables
Gateweaver supports using environment variables in your configuration file. This allows you to define dynamic values that can be set at runtime. You can use the ${VAR_NAME}
syntax to reference environment variables in your configuration file.
Usage
Here is an example of using environment variables in a configuration file:
gateweaver.yml
endpoints:
- path: "/todos"
target:
url: "${API_URL}/todos"
request:
headers:
Authorization: "Bearer ${API_KEY}"
To use environment variables in your local development environment, you can create a .env.gateweaver
file. This must be created where you run the Gateweaver CLI start command.
.env.gateweaver
NODE_ENV=development
API_URL=https://example.com
API_KEY=your-api-key
Remember to add the .env.gateweaver
file to your .gitignore
file to prevent it from being committed to your repository.
In production, you can set environment variables using your hosting provider's dashboard or CLI.