| Crates.io | dovetail |
| lib.rs | dovetail |
| version | 2.0.1 |
| created_at | 2023-11-18 22:48:30.853116+00 |
| updated_at | 2024-08-10 18:01:20.841987+00 |
| description | Dovetail 🕊️ is a cgi and static file server for gemini. |
| homepage | https://codeberg.org/catboomer/dovetail |
| repository | https://codeberg.org/catboomer/dovetail |
| max_upload_size | |
| id | 1040768 |
| size | 72,201 |
Dovetail is a cgi and static file server for gemini, inspired by agate, built with 🦊 Fluffer.
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
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 |
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]}"