Small temp redis-based pastebin server.
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.
Diane a70e672ad7
updated repo link
1 year ago
exporter Documented unit used for memory usage check 3 years ago
static Added favicon 2 years ago
storage WIP: Integrated Prometheus stats 3 years ago
templates updated repo link 1 year ago
.editorconfig Dockerized, modulized the project 4 years ago
.gitignore Integrated main templates and started designing new view mode switch, noted TODOs 2 years ago
LICENSE Base commit 4 years ago Documented new release 3 years ago
config.go Finished stylizing generic error page 3 years ago
generator.go Removed useless dependency, simplified key id format 3 years ago
go.mod Integrated new search bar design for view mode toggle 3 years ago
go.sum Integrated markdown rendering 3 years ago
handlers.go Uniformized error pages 2 years ago
log.go Bumped to 1.13, added centralized logging 3 years ago
main.go WIP: Integrated Prometheus stats 3 years ago
templates.go Integrated markdown rendering 3 years ago
todo.txt removed server-side syntaxic coloration, wontfix 2 years ago


Small temp redis-based pastebin server.

Table of contents


This is a daemon that is meant to run behind a HTTP reverse proxy such as Caddy, Lighttpd, or Haproxy.

You can use whichever RP you want, though.

You'll need a daemon manager, such as systemd or supervisord, to keep it alive in a reliable way.

You'll also need a redis server, in which to store temporary pastes.


$ paste -h
Usage of ./paste:
  -config string
    	Path to directory containing the configuration file (default ".")

By default, paste is configured to run in a simple way, without any required configuration.

If you have a custom configuration store you want to use, you can use the CLI argument -config to provide a custom directory in which paste can find a paste.<ext> configuration file.


  • Ephemeral paste storing (up to 1 day)
  • Built-in prometheus stats collecting (see Prometheus stats)
  • Three view modes
    • Source-code (with syntaxic coloration)
    • Markdown rendering mode (HTML-escaped)
    • Raw data (for document retrieval)


By default, Paste uses the viper configuration library, thus supporting every configuration format viper supports.

However, I'd recommend going for TOML, a pretty simple, but strict, clear, and well-designed, configuration format.

The following configuration variables are available.

  • Http.Host (default HTTP listening interface host
  • Redis.Address (default Redis URL
  • Redis.Password (default ""): Redis password
  • Redis.Database (default 0): Redis database
  • Prometheus.Enabled (default false): Should the prometheus collector server be started?
  • Prometheus.Host (default Prometheus collector listening interface host

You should put the configuration file inside the process' working directory, or provide a path to the folder containing the configuration file using the associated flag.

You can also provide configurations through the environment.

Since the environment keys are case-insensitive, Http.Host is the exact same as HTTP.HOST.

The loading order is:

  • Environment variable
  • In-file value
  • Default value

An example configuration can be found below.

Configuration example

Default values are kept for Redis.Password and Redis.Database.

The host is configured in a TOML file, put in the PWD.

# paste.toml
host = ""

The Redis remote server address is configured through the environment.


Prometheus stats

Paste (since v2.0.0) comes with built-in support for Prometheus stats.

The following stats are available.

  • paste_count (constant): Number of pastes currently stored
  • paste_total_paste_size (constant): The total memory used by paste storing (in bytes)
  • paste_average_paste_size (constant): The average memory used by pastes (in bytes)