Open FrankKair opened 2 years ago
More generally all the $VAR
values can be seen as dynamic parameters. Take the following example:
url = "https://example.com"
method = "GET"
[params]
custom = "$ARG1"
When calling treqs
, this is what it would look like:
$ treqs example.toml ARG1=hello
Which means that besides checking $ENV
and .env
files, we could also accept key-value pairs as arguments to the CLI.
When testing APIs with authentication, you often have a
.env
file with secrets, i.e.:It would be good for
treqs
to be able to access these values in runtime, instead of adding them to the TOML files (thus exposing company secrets):In runtime,
treqs
could check:$ENV
(the shell environment);.env
in the directory of the TOML file;.env
in the parent directory of the TOML file (git repository root);.env
in the current directory.Once
treqs
finds a.env
file that containsAPI_PASSWORD
, it can substitute the$API_PASSWORD
value withSOME_PWD_HERE
. Such action/function could either be part ofChecker
or a new module (example below):