Throttler env
Environment variables for the throttler.
After the throttler was set up, environment variables were created for it. Let's then check it out.
First, they have been written in the .env and .env.example files. Nothing out of the ordinary so far.
Then, in the env.constants file, we can enforce that they must be positive integers. Note that this improved validation can also be applied to the DATASOURCE_PORT
variable.
Next, we may create its configuration namespace in auth -> config -> throttler.config.
Note that:
The variables must be cast to number, as they are strings
The
ttl
is converted here to ms, as to avoid doing this in the .env file
Finally, all that's left to do is to use it when configuring the ThrottlerModule
in the AuthModule
.
Remember to delete the auth.constants file, no longer used.
Commit - Environment variables for throttler
Last updated