140 lines
4.5 KiB
PHP
140 lines
4.5 KiB
PHP
<?php
|
|||
|
|
|
||
|
|
return [
|
||
|
|
|
||
|
|
/*
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
| Gutendex API Base URL
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
|
|
||
|
|
| The base URL for the Gutendex API. This is the Project Gutenberg
|
||
|
|
| catalog API that provides metadata about public domain books.
|
||
|
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
'api_url' => env('GUTENDEX_API_URL', 'https://gutendex.com'),
|
||
|
|
|
||
|
|
/*
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
| Default Language Filter
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
|
|
||
|
|
| The default language code to use when fetching books from Gutendex.
|
||
|
|
| Common values: 'en' (English), 'fr' (French), 'de' (German), etc.
|
||
|
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
'default_language' => env('GUTENDEX_DEFAULT_LANGUAGE', 'en'),
|
||
|
|
|
||
|
|
/*
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
| Batch Size
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
|
|
||
|
|
| The number of books to process in a single batch import operation.
|
||
|
|
| Adjust based on your server capacity and Ollama processing speed.
|
||
|
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
'batch_size' => env('GUTENDEX_BATCH_SIZE', 50),
|
||
|
|
|
||
|
|
/*
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
| Rate Limit Delay
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
|
|
||
|
|
| Delay in milliseconds between API requests to respect rate limits.
|
||
|
|
| Increase if you encounter 429 (Too Many Requests) errors.
|
||
|
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
'rate_limit_delay' => env('GUTENDEX_RATE_LIMIT_DELAY', 1000),
|
||
|
|
|
||
|
|
/*
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
| Request Timeout
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
|
|
||
|
|
| Maximum time in seconds to wait for a response from the Gutendex API.
|
||
|
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
'timeout' => env('GUTENDEX_TIMEOUT', 30),
|
||
|
|
|
||
|
|
/*
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
| Retry Configuration
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
|
|
||
|
|
| Configuration for retrying failed API requests.
|
||
|
|
| - max_attempts: Maximum number of retry attempts
|
||
|
|
| - backoff_multiplier: Multiplier for exponential backoff (in seconds)
|
||
|
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
'retry' => [
|
||
|
|
'max_attempts' => env('GUTENDEX_RETRY_MAX_ATTEMPTS', 3),
|
||
|
|
'backoff_multiplier' => env('GUTENDEX_RETRY_BACKOFF', 2),
|
||
|
|
],
|
||
|
|
|
||
|
|
/*
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
| Copyright Filter
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
|
|
||
|
|
| Filter books by copyright status. Setting to 'false' will only fetch
|
||
|
|
| public domain books. Setting to 'true' includes copyrighted works.
|
||
|
|
| It's recommended to keep this as 'false' for legal compliance.
|
||
|
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
'copyright' => env('GUTENDEX_COPYRIGHT_FILTER', 'false'),
|
||
|
|
|
||
|
|
/*
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
| Cache Configuration
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
|
|
||
|
|
| Enable caching of Gutendex API responses to reduce API calls.
|
||
|
|
| - enabled: Whether to cache responses
|
||
|
|
| - ttl: Time to live in seconds (default: 24 hours)
|
||
|
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
'cache' => [
|
||
|
|
'enabled' => env('GUTENDEX_CACHE_ENABLED', true),
|
||
|
|
'ttl' => env('GUTENDEX_CACHE_TTL', 86400),
|
||
|
|
],
|
||
|
|
|
||
|
|
/*
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
| Category Mapping
|
||
|
|
|--------------------------------------------------------------------------
|
||
|
|
|
|
||
|
|
| Map Gutendex subjects/bookshelves to your application's categories.
|
||
|
|
| This helps in auto-categorizing imported books.
|
||
|
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
'category_mapping' => [
|
||
|
|
'Fiction' => 'fiction',
|
||
|
|
'Science Fiction' => 'science-fiction',
|
||
|
|
'Fantasy' => 'fantasy',
|
||
|
|
'Mystery' => 'mystery',
|
||
|
|
'Romance' => 'romance',
|
||
|
|
'Historical Fiction' => 'historical-fiction',
|
||
|
|
'Biography' => 'biography',
|
||
|
|
'History' => 'history',
|
||
|
|
'Philosophy' => 'philosophy',
|
||
|
|
'Science' => 'science',
|
||
|
|
'Technology' => 'technology',
|
||
|
|
'Business' => 'business',
|
||
|
|
'Self-Help' => 'self-help',
|
||
|
|
'Poetry' => 'poetry',
|
||
|
|
'Drama' => 'drama',
|
||
|
|
'Children' => 'children',
|
||
|
|
// Add more mappings as needed
|
||
|
|
],
|
||
|
|
|
||
|
|
];
|