# static-server
-A static server in golang
+
+A static server in golang.
+
+## Usage
+
+To use this code you must clone and build it yourself, no binaries.
+
+### Clone
+
+ git clone git@git.scompo.it:~/repos/static-server.git
+
+### Build
+
+ cd static-server
+ go build .
+
+### Run
+
+ ./static-server
+ 2020/09/01 17:41:47 static-server serving directory: ./static on port: :4000
+
+## Systemd
+
+There's an example of a systemd unit called `server.service`.
+
+# Enviroinment variables
+
+- SERVER_PORT port to listen to (default `:4000`).
+- SERVER_DIR directory from where to serve (default `./static`).
--- /dev/null
+[Unit]
+Description=static-server
+After=network.target
+
+[Service]
+Type=simple
+Restart=always
+RestartSec=1
+User=user
+Environment="SERVER_DIR=/var/lib/www"
+ExecStart=/usr/local/bin/static-server
+
+[Install]
+WantedBy=multi-user.target