You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Syfaro 8ea6025ad6 Other minor code quality improvements. 2 months ago
src Other minor code quality improvements. 2 months ago
.dockerignore Add Dockerfile and .drone.yml. 2 months ago
.drone.yml Add Dockerfile and .drone.yml. 2 months ago
.gitignore Initial implementation of link shortener. 2 months ago
Cargo.lock Initial implementation of link shortener. 2 months ago
Cargo.toml Initial implementation of link shortener. 2 months ago
Dockerfile Add Dockerfile and .drone.yml. 2 months ago
README.md Change listen host, add README. 2 months ago

README.md

links

A simple and single-user link shortener written in Rust. Makes use of the nickel.rs framework. Stores links in a SQLite database and caches them in memory.

Configuration

There are a number of environment variables used to configure the behavior.

  • HOST — The path this application lives at without a trailing slash, such as https://example.com/links
  • TOKEN — Authentication token required to create a link
  • DATABASE — Path to SQLite database
  • LISTEN [optional] — HTTP listen host, defaults to 0.0.0.0:8080
  • KEEP_EXT [optional] — Comma separated list of file extensions to keep by default, defaults to png,jpg,jpeg,gif,mp4,txt

Usage

Send a POST request to the /add endpoint with a JSON object containing the link to shorten. You may optionally include a name to use for the shortened link. Names can override previous links. You must set the Authorization header to Basic <base64 encoded token>.

After a successful request, a JSON object is returned containing the shortened link.