Initial status page

This commit is contained in:
Tom Wiesing 2022-09-16 17:54:40 +02:00
parent a3511b1bfc
commit a1f35b97d3
No known key found for this signature in database
17 changed files with 618 additions and 83 deletions

View file

@ -8,25 +8,36 @@ import (
// Info represents some info about this WissKI
type Info struct {
Slug string // The slug of the instance
URL string // The public URL of this instance
Running bool // is the instance running?
DrupalVersion interface{} // version of drupal being used
Running bool // is the instance running?
Pathbuilders []string // list of pathbuilders
}
// Info returns information about this WissKI instance.
func (wisski *WissKI) Info() (info Info, err error) {
func (wisski *WissKI) Info(quick bool) (info Info, err error) {
// static properties
info.Slug = wisski.Slug
info.URL = wisski.URL().String()
// dynamic properties, TODO: Add more properties here!
var group errgroup.Group
// quick check if this wisski is running
group.Go(func() (err error) {
info.Running, err = wisski.Alive()
return
})
// slower checks for extra properties.
// these execute php code
if !quick {
group.Go(func() (err error) {
info.Pathbuilders, err = wisski.Pathbuilders()
return
})
}
err = group.Wait()
return
}