mholt / caddy-sqlite-fs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQLite FS plugin for Caddy

Warning

I whipped this up quickly as a proof of concept. It is experimental and likely has bugs.

This package implements a virtual file system for Caddy using SQLite.

It expects a path to a SQLite database with at least this table in its schema:

CREATE TABLE IF NOT EXISTS "files" (
	"name" TEXT PRIMARY KEY, -- full file path compliant with: https://pkg.go.dev/io/fs#ValidPath
	"content" BLOB,          -- file bytes
	"modified" INTEGER,      -- unix timestamp of last modification
	"mode" INTEGER           -- file mode
);

It can be used like so in the Caddyfile:

file_server /database/* {
	fs sqlite data.sql
}

Note

This is not an official repository of the Caddy Web Server organization.

About

License:MIT License


Languages

Language:Go 100.0%