Introduction
dn42-wiki-go is a lightweight, Git-backed wiki engine designed for DN42. It is based on wiki-ng, aims to replace the old Gollum-based DN42 distributed wiki.
It can serve pages live through its built-in Go HTTP server or generate a fully static HTML export for external hosting. All content is stored in a Git repository, making it easy to replicate across nodes or run in disconnected environments.
Operating Modes
You can run dn42-wiki-go in three different ways:
-
Run static build once then exit (
--buildorlive=false)
The App renders all Markdown files into HTML under outputDir and exits.
Best for setups where your own cron job handles Git sync and file publishing. -
Live mode without reverse proxy (
live=true)
The built-in HTTP server directly serves pages, assets, and APIs.
Suitable for simple deployments. -
Live mode behind a reverse proxy
The reverse proxy (nginx, Caddy, HAProxy, etc.) serves the generated files, and only API endpoints are forwarded to the App.
Seeconfig.example.jsonfor example configs andnginx-vhost.conffor a reverse-proxy reference.Recommended for production and anycast nodes.
Features
- Live mode with automatic Markdown rendering and scheduled Git pull/push.
- Static mode for fully pre-built HTML exports.
- Optional in-browser editor with commit metadata (author, message prefix, remote IP).
- Webhook endpoints for remote pull/push triggers and optional polling integration(see
dn42notifyd). - Themeable templates and bundled UI assets.
- Designed for distributed, multi-node and anycast environments.
Quick Start
Pre-built binaries are available in the GitHub releases.
Please do not forget to clone the repository to copy config.example.json and the template folder. They should be put together in the same production directory.
Manual Build
- Install Go 1.24+ and ensure the git executable is available in PATH.
- Copy the example config: cp config.example.json config.json Then edit the settings you need.
- Build for your platform (example: Linux amd64):
export GOOS=linux export GOARCH=amd64 ./build.sh
Webhook Endpoints
When webhook.enabled = true, the server exposes:
-
GET | POST /api/webhook/pull
Runs git pull and rebuilds the cached HTML. -
GET | POST /api/webhook/push
Pushes local commits to the remote.
If webhook.secret is set, requests must include an Authorization header that matches the secret.
Polling Integration
When webhook.polling.enabled = true, the server registers with a remote notify service and triggers /api/webhook/pull whenever a refresh completes.
This is compatible with dn42notifyd and similar tools.
Configuration Reference
All settings are provided through a JSON file. Below is a concise reference of all options.
Runtime
-
live(bool, defaultfalse):
true -> run HTTP server and render on demand.
false -> render once to outputDir and exit. -
editable(bool, defaultfalse):
Enables in-browser editing and write operations. -
listen(string, default":8080"):
TCP address (host:port) or UNIX socket (unix:/path).Advanced: See example systemd files
dn42-wiki-go.socketanddn42-wiki-go.servicein the repository. -
baseUrl(string, optional):
URL prefix when hosting under a subdirectory. -
siteName(string, default"DN42 Wiki Go"):
Display name of the wiki.
Git
-
git.binPath(string, defaultgit): Path to the Git executable. -
git.remote(string, default empty): Remote URL. Leave empty for standalone/local repositories. -
git.localDirectory(string, default./repo): Directory where the wiki repository is cloned or initialised. -
git.pullIntervalSec(int, default300): Seconds between backgroundgit pulloperations in live mode. Disabled if no remote is set. -
git.author(string, default"Anonymous <anonymous@localhost>"): Author string used for commits generated by the application, unless a custom author is provided per request. -
git.commitMessagePrefix(string, default empty): Optional prefix prepended verbatim to commit messages supplied by users. -
git.commitMessageAppendRemoteAddr(string, default empty): Optional suffix appended when a request carries a remote address. If the value contains%sit is treated as afmtformat string; otherwise it is concatenated.
Webhook
-
webhook.enabled(bool, defaultfalse): Expose webhook endpoints on the main HTTP server. -
webhook.secret(string, default empty): Shared secret expected in theAuthorizationheader. Ignored when empty. -
webhook.polling.enabled(bool, defaultfalse): Keep a registration active with the remote notification service and trigger periodic pulls. -
webhook.polling.endpoint(string, default empty): URL of the notification service (eg. Usage with dn42notifyd:https://git.dn42/dn42notify/poll). -
webhook.polling.callbackUrl(string, default empty): Public URL for/api/webhook/pull. Required whenwebhook.polling.enabledistrue. -
webhook.polling.pollingIntervalSec(int, default3600): Seconds between refresh attempts. Must be positive when polling is enabled. -
webhook.polling.skipRemoteCert(bool, defaultfalse): Insecure: Skip TLS verification.
Paths and templating
-
outputDir(string, default./dist): Destination directory for static builds or asset exports. -
templateDir(string, default./template): Location of layout templates and static assets bundled into the server/UI. -
homeDoc(string, defaultHome.md): Repository document to treat as the home page. Normalised to a.mdpath relative to the repo root. -
privatePagesPrefix(array of strings, default empty): Request to routes started with these prefixes will be blocked.
Layout and footer
-
ignoreHeader(bool, defaultfalse): Skip loading_Header.mdwhentrue. Leavefalseto include the fragment when present. -
ignoreFooter(bool, defaultfalse): Skip_Footer.mdwhentrue; otherwise render it if available. -
serverFooter(string, default empty): Markdown snippet rendered into the global footer at runtime.
TLS
-
enableTLS(bool, defaultfalse): Serve HTTPS using the provided certificate and key. -
tlsCert(string): Path to the TLS certificate. Required only whenenableTLSis true. -
tlsKey(string): Path to the TLS private key. Required whenenableTLSis true.
Logging and client IP handling
-
logLevel(string, defaultinfo): Minimum log level (debug,info,warn, orerror). -
trustedProxies(array of strings, default empty): CIDR blocks or literal IPs that are trusted to populateX-Forwarded-For. -
trustedRemoteAddrLevel(int, default1): Number of additional trusted hops to peel off when deriving the end-user IP from the forwarded chain. Values less than1are coerced to1during load.
Notes
- live = true requires write access to the Git repo for local commits.
- With no remote configured,
dn42-wiki-goinitializes a local-only repository. - Template changes require restarting the server or rebuilding static output.
