tangled
alpha
login
or
join now
evan.jarrett.net
/
core
forked from
tangled.org/core
Monorepo for Tangled — https://tangled.org
0
fork
atom
overview
issues
pulls
pipelines
Compare changes
Choose any two refs to compare.
base:
spindle-workflowgroup
spindle-workflow
spindle-motd
spindle-log-err
secret-masking
openbao-tests
nixery-fix
master
loom
empty-repo-copyable
diff-copy-span
compare-view
buildah-engine
v1.11.0-alpha
v1.10.0-alpha
v1.9.1-alpha
v1.9.0-alpha
v1.8.1-alpha
v1.8.0-alpha
v1.7.0-alpha
v1.6.0-alpha
v1.5.0-alpha
v1.4.0-alpha
v1.3.0-alpha
v1.2.2-alpha
v1.2.1-alpha
v1.2.0-alpha
v1.1.2-alpha
v1.1.1-alpha
v1.1.0-alpha
v1.0.6-alpha
v1.0.5-alpha
v1.0.4-alpha
v1.0.3-alpha
v1.0.2-alpha
v1.0.1-alpha
v1.0.0-alpha
compare:
spindle-workflowgroup
spindle-workflow
spindle-motd
spindle-log-err
secret-masking
openbao-tests
nixery-fix
master
loom
empty-repo-copyable
diff-copy-span
compare-view
buildah-engine
v1.11.0-alpha
v1.10.0-alpha
v1.9.1-alpha
v1.9.0-alpha
v1.8.1-alpha
v1.8.0-alpha
v1.7.0-alpha
v1.6.0-alpha
v1.5.0-alpha
v1.4.0-alpha
v1.3.0-alpha
v1.2.2-alpha
v1.2.1-alpha
v1.2.0-alpha
v1.1.2-alpha
v1.1.1-alpha
v1.1.0-alpha
v1.0.6-alpha
v1.0.5-alpha
v1.0.4-alpha
v1.0.3-alpha
v1.0.2-alpha
v1.0.1-alpha
v1.0.0-alpha
go
+21
-3
1 changed file
expand all
collapse all
unified
split
spindle
server.go
+21
-3
spindle/server.go
···
8
8
"log/slog"
9
9
"maps"
10
10
"net/http"
11
11
+
"sync"
11
12
12
13
"github.com/go-chi/chi/v5"
13
14
"tangled.org/core/api/tangled"
···
30
31
)
31
32
32
33
//go:embed motd
33
33
-
var motd []byte
34
34
+
var defaultMotd []byte
34
35
35
36
const (
36
37
rbacDomain = "thisserver"
···
47
48
cfg *config.Config
48
49
ks *eventconsumer.Consumer
49
50
res *idresolver.Resolver
50
50
-
vault secrets.Manager
51
51
+
vault secrets.Manager
52
52
+
motd []byte
53
53
+
motdMu sync.RWMutex
51
54
}
52
55
53
56
// New creates a new Spindle server with the provided configuration and engines.
···
128
131
cfg: cfg,
129
132
res: resolver,
130
133
vault: vault,
134
134
+
motd: defaultMotd,
131
135
}
132
136
133
137
err = e.AddSpindle(rbacDomain)
···
201
205
return s.e
202
206
}
203
207
208
208
+
// SetMotdContent sets custom MOTD content, replacing the embedded default.
209
209
+
func (s *Spindle) SetMotdContent(content []byte) {
210
210
+
s.motdMu.Lock()
211
211
+
defer s.motdMu.Unlock()
212
212
+
s.motd = content
213
213
+
}
214
214
+
215
215
+
// GetMotdContent returns the current MOTD content.
216
216
+
func (s *Spindle) GetMotdContent() []byte {
217
217
+
s.motdMu.RLock()
218
218
+
defer s.motdMu.RUnlock()
219
219
+
return s.motd
220
220
+
}
221
221
+
204
222
// Start starts the Spindle server (blocking).
205
223
func (s *Spindle) Start(ctx context.Context) error {
206
224
// starts a job queue runner in the background
···
246
264
mux := chi.NewRouter()
247
265
248
266
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
249
249
-
w.Write(motd)
267
267
+
w.Write(s.GetMotdContent())
250
268
})
251
269
mux.HandleFunc("/events", s.Events)
252
270
mux.HandleFunc("/logs/{knot}/{rkey}/{name}", s.Logs)