- Logger doesn't start with log level DEBUG by default, instead reads a environment variable - Secret handler raises exceptions instead of using the module os to exit - Added extensive debug logging - Added detailed function descriptions - Added exponential backoff when parsing the RSS feed
59 lines
1.1 KiB
Markdown
59 lines
1.1 KiB
Markdown
# Service: Royalroad Chapters
|
|
|
|
|
|
## Overview
|
|
|
|
`service-royalroad-chapters` is a FastAPI-based webserver that monitors Royalroad stories for new chapters and sends notifications data to `backend-api-internal`.
|
|
|
|
## Features
|
|
|
|
- Fetches the latest chapters from Royalroad RSS feeds.
|
|
|
|
- Updates the database when new chapters are released.
|
|
|
|
- Sends push notifications for new chapters.
|
|
|
|
- Prometheus metrics integrated for monitoring request counts.
|
|
|
|
|
|
## Endpoints
|
|
### GET `/royalroad`
|
|
- Checks for new chapters for all active stories in the database.
|
|
- Updates the `lastChapter` field in the database.
|
|
- Sends notifications if a new chapter is found.
|
|
- Response:
|
|
```json
|
|
{
|
|
"status": "checked"
|
|
}
|
|
```
|
|
|
|
## Requirements
|
|
|
|
- Python 3.12+
|
|
|
|
- MySQL database
|
|
|
|
- Python packages from requirements.txt
|
|
|
|
## Configuration
|
|
|
|
**Environment variables:**
|
|
|
|
- `LOG_LEVEL` (DEBUG, INFO, WARNING, ERROR, CRITICAL)
|
|
|
|
- Database credentials: `MYSQL_HOST`, `MYSQL_USER`, `MYSQL_PASSWORD`, `MYSQL_DATABASE`
|
|
|
|
- `API_KEY_INTERNAL`
|
|
|
|
- `BACKEND_API_URL`
|
|
|
|
|
|
## Metrics
|
|
|
|
Metrics are exposed on port `9000` for Prometheus
|
|
|
|
## Running the Service
|
|
|
|
- Inside the `src` folder `python main.py`
|