index : license-api-rs.git

ascending towards madness

# license-api-rs

A drop-in Rust implementation of [my old open source license api]https://git.holly.sh/license-api.git that was written in PHP.

## Usage

```
LICENSE_API_DATABASE="/path_to/your/license_database.yml"
cargo run

curl 0.0.0.0:8080/
curl 0.0.0.0:8080/list
curl 0.0.0.0:8080/list/full
curl 0.0.0.0:8080/<license>
```

## Configuration

The server by default will run on `0.0.0.0:8080` with a base URL of `/`

There is no default database set.

Configuration is done through environment variables.

```shell
export LICENSE_API_BASE_URL="/"
export LICENSE_API_DATABASE="/path_to/your/license_database.yml"
export LICENSE_API_SERVER_IP="0.0.0.0"
export LICENSE_API_SERVER_PORT="8080"
export LICENSE_API_WELCOME_MESSAGE="/path/to/welcome.txt"
```

All environment variables except for `LICENSE_API_DATABASE` are optional. If `LICENSE_API_DATABASE` is not set, the server will refuse to start.

## Docker

This project has first-class Docker support. I prefer to not pull my images from a repository, as that leaves one vulnerable to supply chain attacks. To build the Docker image, simply run `docker build -t lapi:latest .` in the repository directory.

I am using [Alpine]https://hub.docker.com/_/alpine/ as a base image, and the application is built using the `x86_64-unknown-linux-musl` [build target]https://blog.rust-lang.org/2023/05/09/Updating-musl-targets.html.

A sample `docker-compose.yml` file is also included.

On my staging server, this service uses 964 KB of RAM with my [license database]https://git.holly.sh/license-db.git, so it is lightweight.

## License

- [AGPL 3.0]LICENSE