+1
spindle/config/config.go
+1
spindle/config/config.go
···
20
20
LogDir string `env:"LOG_DIR, default=/var/log/spindle"`
21
21
QueueSize int `env:"QUEUE_SIZE, default=100"`
22
22
MaxJobCount int `env:"MAX_JOB_COUNT, default=2"` // max number of jobs that run at a time
23
+
MOTDFile string `env:"MOTD_FILE"` // optional path to custom MOTD file
23
24
}
24
25
25
26
func (s Server) Did() syntax.DID {
+8
spindle/server.go
+8
spindle/server.go
···
8
8
"log/slog"
9
9
"maps"
10
10
"net/http"
11
+
"os"
11
12
12
13
"github.com/go-chi/chi/v5"
13
14
"tangled.org/core/api/tangled"
···
246
247
mux := chi.NewRouter()
247
248
248
249
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
250
+
if s.cfg.Server.MOTDFile != "" {
251
+
if content, err := os.ReadFile(s.cfg.Server.MOTDFile); err == nil {
252
+
w.Write(content)
253
+
return
254
+
}
255
+
s.l.Warn("failed to read custom MOTD file, using default", "path", s.cfg.Server.MOTDFile)
256
+
}
249
257
w.Write(motd)
250
258
})
251
259
mux.HandleFunc("/events", s.Events)