Configuration¶
This section provides an overview of the configuration options available for the Quotes API. The configuration is managed via the config.toml file, located in the root of the project. This file allows you to adjust various settings, such as server port, logging levels, and default quote appearance
Configuration File¶
The config.toml file contains several configuration sections that control different aspects of the Quotes API. Below is an example of the file:
[settings]
[settings.quote]
quality = 85
text_color = "white"
background_color = "#162330"
[settings.logging]
level = "INFO"
[settings.server]
port = 1337
Sections and Settings¶
[settings.quote]
This section defines the default appearance of the generated quote images
- width (
int): The width of the generated quote image in pixels. Default:
1792
- width (
- text_color (
str): The default color of the quote text. Accepts any valid CSS color value (e.g.,
"black","#ffffff"). Default:"white"
- text_color (
- background_color (
str): The default background color for the quote. Accepts any valid CSS color value. Default:
"#162330"
- background_color (
[settings.logging]
This section controls the logging level for the application. Logging helps with debugging and monitoring the application by outputting messages about its operations
- level (
str): Defines the logging verbosity. Valid values are
"DEBUG","INFO","WARNING","ERROR", and"CRITICAL". Default:"INFO"
- level (
[settings.server]
This section controls the server’s behavior, such as the port on which the API will run
- port (
int): The port on which the FastAPI application will listen for incoming requests. Default:
1337
- port (
Customizing the Configuration¶
You can customize the behavior of the Quotes API by modifying the config.toml file. For example, to change the port number to 8080 and set the logging level to DEBUG, you would update the file as follows:
[settings]
[settings.server]
port = 8080
[settings.logging]
level = "DEBUG"