forked from aarondl/authboss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.go
More file actions
34 lines (28 loc) · 746 Bytes
/
Copy pathmodule.go
File metadata and controls
34 lines (28 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package authboss
var modules = make(map[string]Modularizer)
// Modularizer should be implemented by all the authboss modules.
type Modularizer interface {
Initialize(*Config) error
Routes() RouteTable
Storage() StorageOptions
}
// RegisterModule with the core providing all the necessary information to
// integrate into authboss.
func RegisterModule(name string, m Modularizer) {
modules[name] = m
}
// LoadedModules returns a list of modules that are currently loaded.
func LoadedModules() []string {
mods := make([]string, len(modules))
i := 0
for k, _ := range modules {
mods[i] = k
i++
}
return mods
}
// IsLoaded checks if a specific module is loaded.
func IsLoaded(mod string) bool {
_, ok := modules[mod]
return ok
}