Environment variables allows you to set variables arbitrarily. These variables
are added to the internal cache just as the response of any other request is.
This means they can be used anywhere normal requests can be composed on. These
are added under the
env key, which means you can compose them using
anywhere you want to.
You can define them using the
environment key. All values under this key will
be available under the
$env variable for your use.
... environment: the: post: 15 GET /posts/$env.the.post: get-post
Beau supports DotEnv out of the box. Any variables defined in your .env file will be available as a environmental variable within your beau.yml file.
POST available under
$env._ in your beau file. You can use it
... GET /post/$env._.POST: get-post
Keep in mind that variables defined in your
.env will override variables
defined in your beau.yml file. So given this
... environment: _: post: 1 GET /post/$env._.post: get-post
$env._.post will resolve to "2". You can use this to have defaults in place
which can be replaced locally as needed.
Remember to keep your .env file out of your repo to prevent weird, hard-to-debug bugs.
These external environment variables are also shared with the
paramflag when requesting something. They also have a lower priority so you can use the
paramflag to override these values. Checkout Request for more information.