66 lines
1.5 KiB
Markdown
66 lines
1.5 KiB
Markdown
# Rust Image Proxy
|
|
|
|
## Overview
|
|
|
|
This Rust project is a versatile image proxy designed to efficiently handle
|
|
image requests. Users can customize the caching behavior through a YAML
|
|
configuration file, choosing between in-memory, on-disk or mixed (memory and
|
|
disk) caching based on provided regular expressions.
|
|
|
|
## Features
|
|
|
|
- **Image Proxy:** Efficiently fetches and serves images from remote sources.
|
|
- **Caching:** Supports both in-memory and on-disk caching for improved
|
|
performance.
|
|
- **Configuration:** Customize caching behavior using a YAML configuration file.
|
|
- **Regex-Based Caching:** Specify caching strategy based on a regular
|
|
expression.
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- [Rust](https://www.rust-lang.org/tools/install) must be installed.
|
|
|
|
### Installation
|
|
|
|
Clone the repository:
|
|
|
|
```bash
|
|
git clone https://gitea.qpismont.fr/qpismont/imgproxy-rs.git
|
|
cd rust-image-proxy
|
|
```
|
|
|
|
Build the project:
|
|
|
|
```bash
|
|
cargo build --release
|
|
```
|
|
|
|
### Configuration
|
|
|
|
Create a YAML configuration file (config.yml) with the following structure:
|
|
|
|
```yaml
|
|
storages:
|
|
- strategy: !Mixed {path: "./cache", max_size: 128000, ttl: 32}
|
|
regex: "REGEX_HERE"
|
|
- strategy: !Memory {max_size: 128000, ttl: 32}
|
|
regex: "REGEX_HERE"
|
|
- strategy: !Disk {path: "./cache", max_size: 128000, ttl: 32}
|
|
regex: "REGEX_HERE"
|
|
|
|
secret_key: "THIS_IS_SECRET"
|
|
|
|
expose_api: true
|
|
```
|
|
|
|
Adjust the regex values and storage configurations as needed.
|
|
|
|
### Usage
|
|
|
|
Run the proxy using the following command:
|
|
|
|
```bash
|
|
cargo run --release
|
|
```
|