Skip to content

Configuration

Snipraw's snippets directory, title, description, base URL, attribution, and log level are set via a YAML config file. Host and port are CLI-only, see Command Line.

Config file

Snipraw does not assume a default config path. Point it at a file with --config (or -c):

bash
snipraw -c ~/.config/snipraw/config.yaml

The file must exist; snipraw will not create one for you.

yaml
snippets-dir: ~/snippets
title: Snipraw
desc: My personal code snippets
base-url: ""
attribution: true
log-level: info

Reference

KeyDefaultDescription
snippets-dirDirectory to serve snippets from. Required.
titleSniprawSite title shown in the UI
descSite description, used in meta tags
base-urlCanonical base URL, used in meta tags
attributiontrueShow "Hosted with Snipraw" in the footer
log-levelinfoLog level: trace, debug, info, warn, error, fatal, panic, disabled

Binding to all interfaces

Host/port are CLI flags, not config fields. To make snipraw accessible on your local network:

bash
snipraw --host 0.0.0.0 --port 8245 -c ~/.config/snipraw/config.yaml

WARNING

Snipraw has no built-in authentication. Binding to 0.0.0.0 exposes it to anyone on your network. Put it behind a reverse proxy with its own auth layer if you need to restrict access.

Using a different port

bash
snipraw --port 8080 -c ~/.config/snipraw/config.yaml

Config file location

You can put the config file anywhere:

bash
snipraw -c /etc/snipraw/config.yaml

This is useful when running snipraw as a system service.