dovetail

Crates.iodovetail
lib.rsdovetail
version2.0.1
sourcesrc
created_at2023-11-18 22:48:30.853116
updated_at2024-08-10 18:01:20.841987
descriptionDovetail 🕊️ is a cgi and static file server for gemini.
homepagehttps://codeberg.org/catboomer/dovetail
repositoryhttps://codeberg.org/catboomer/dovetail
max_upload_size
id1040768
size72,201
(catb00mer)

documentation

README

🕊️ Dovetail

Dovetail is a cgi and static file server for gemini, inspired by agate, built with 🦊 Fluffer.

🧰 Tutorial

To get started, create a content directory. This directory will mirror how your routes are laid out.

  • A CGI script must be executable, and have the .cgi file extension. This extension is ignored in the actual route.

  • You can serve a gemtext document or a CGI script at the root of a path by naming it either index.gmi or index.gmi.cgi.

  • Also, mimetypes are guessed by a file's extension. Make sure your static files have accurate extensions.

Dovetail is configured using command-line arguments, for example:

dovetail --lang en --ip 0.0.0.0:1965 --content ./content

📜 Scripts

The server will attempt to execute files with the .cgi extension, which is elided from the route. In other words, /comment should correspond to the file content_dir/comment.cgi.

Below is a table of environment variables that will be made available to your CGI scripts. Make sure your script correctly handles variables that may not exist for every request (marked with "sometimes").

Name Exists
URL Always
URL_PATH Always
URL_INPUT Sometimes
PEER_IP Always
PEER_CERT Sometimes
PEER_NAME Sometimes
PEER_FINGERPRINT Sometimes

🐚 Shell Example

If you're writing a CGI script in a posix shell, this template will help you get started.

Remember to never trust user input too much. Writing CGI scripts in sh can be fun, but also a tad dangerous :')

#!/bin/sh -eu

# shellcheck disable=SC2034
printf '20 text/gemini\r\n'
echo "# Dovetail Script Example"
echo
echo "## Url"
echo "$URL"
echo
echo "### Path"
echo "$URL_PATH"
echo
echo "### Input"
echo "${URL_INPUT:-[no input]}"
echo
echo "## Certificate"
echo "${PEER_CERT:-[no certificate]}"
echo
echo "### Name"
echo "${DOVE_NAME:-[no name]}"
Commit count: 0

cargo fmt