Started LDAP support

This commit is contained in:
2023-10-24 22:15:58 +02:00
parent 4a9a913d66
commit 7bcd00c97b
11 changed files with 669 additions and 82 deletions

31
util/startup/startup.go Normal file
View File

@@ -0,0 +1,31 @@
package startup
// Pre-defined queues...
var (
Logger StartupQueue
PostFlags StartupQueue
)
type StartupQueue struct {
items []func()
hasRun bool
}
func (q *StartupQueue) Add(initFn ...func()) {
if q.hasRun {
panic("Added init function after startup")
}
for _, fn := range initFn {
q.items = append(q.items, fn)
}
}
func (q *StartupQueue) Run() {
if q.hasRun {
panic("Attempted to run init function twice")
}
q.hasRun = true
for _, fn := range q.items {
fn()
}
}