license-api-rs
A drop-in Rust implementation of my old open source license api that was written in PHP.
Usage
LICENSE_API_DATABASE="/path_to/your/license_database.yml"cargo runcurl 0.0.0.0:8080/curl 0.0.0.0:8080/listcurl 0.0.0.0:8080/list/fullcurl 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.
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 as a base image, and the application is built using the x86_64-unknown-linux-musl build target.
A sample docker-compose.yml file is also included.
On my staging server, this service uses 964 KB of RAM with my license database, so it is lightweight.