Add compatibility assistant module
This commit is contained in:
29
compat/api.go
Normal file
29
compat/api.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package compat
|
||||
|
||||
import (
|
||||
"github.com/safing/portbase/api"
|
||||
)
|
||||
|
||||
func registerAPIEndpoints() error {
|
||||
if err := api.RegisterEndpoint(api.Endpoint{
|
||||
Path: "compat/self-check",
|
||||
Read: api.PermitUser,
|
||||
BelongsTo: module,
|
||||
ActionFunc: selfcheckViaAPI,
|
||||
Name: "Run Integration Self-Check",
|
||||
Description: "Runs a couple integration self-checks in order to see if the system integration works.",
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func selfcheckViaAPI(ar *api.Request) (msg string, err error) {
|
||||
_, err = selfcheck(ar.Context())
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return "self-check successful", nil
|
||||
}
|
||||
Reference in New Issue
Block a user