January 2019
Intermediate to advanced
520 pages
14h 32m
English
The .env file contains pairs of names and values of environment variables. For our service, we will set the RUST_LOG, RUST_BACKTRACE, and ADDRESS variables:
RUST_LOG=debugRUST_BACKTRACE=1ADDRESS=0.0.0.0:1234
As you can see, we set all the targets of the logger to the debug level, because cargo doesn't use dotenv and therefore skips these settings.
The RUST_BACKTRACE variable sets the flag to print a backtrace of the application in the case of panic.
Store this file in the working directory from which you will run the application. You can have multiple files and use them for different configurations. This file format is also compatible with Docker and can be used to set variables to the container.
Read now
Unlock full access