Configuration
Set the Firecrawl API key, URL, and timeout, and the largest document to convert.
On this page
The package reads its settings from environment variables:
| Variable | Field | Default | Description |
|---|---|---|---|
ANYDOC_FIRECRAWL_API_KEY |
firecrawl_api_key |
None | The Firecrawl API key. Firecrawl also accepts requests without one, at lower limits. |
ANYDOC_FIRECRAWL_API_URL |
firecrawl_api_url |
https://api.firecrawl.dev |
The Firecrawl API's base URL. |
ANYDOC_FIRECRAWL_TIMEOUT |
firecrawl_timeout |
300 |
How many seconds one request to Firecrawl may take. |
ANYDOC_MAX_FILE_SIZE |
max_file_size |
None | The largest document to convert, in bytes. See Size limit. |
The Firecrawl settings apply to OCR.
Size limit
ANYDOC_MAX_FILE_SIZE sets the largest document to convert, in bytes, whatever its source:
ANYDOC_MAX_FILE_SIZE=20971520A larger document fails with laravel_anydoc::Error::TooLarge; see Handling errors. The package checks the size before it reads the document: a local file's size on disk, an upload's size, and the length of bytes. Storage disks read with Disk::get_with_limit, which stops at the limit.
Without the variable, storage disks keep the framework's 8 MiB read limit, and local files, uploads, and bytes have no package limit. Uploads are still limited by the route's LimitUploads middleware.
Overriding settings in code
The variables fill the fields of the AnydocConfig section. To set a field in code instead, change the section in your application's with_config, which runs after the package's defaults:
use laravel::Application;
use laravel::foundation::ApplicationBuilder;
use laravel_anydoc::AnydocConfig;
pub fn configure() -> ApplicationBuilder {
Application::configure()
.with_providers(|providers| {
providers.add(laravel_anydoc::AnydocServiceProvider);
})
.with_config(|config, _| {
config.section_mut::<AnydocConfig>().max_file_size = Some(20 * 1024 * 1024);
})
}The section's Debug output never includes the API key, so logging it is safe.