// Package catalog lists the apps Base can install. The list is fixed at // build time; an operator enables each app on the Platform account once. package catalog import ( _ "embed" "encoding/json" ) // Entry describes one installable app. ID doubles as a DNS label part, so it // is lowercase letters, digits and hyphens. Tint is one of "amber", "teal", // "violet", "mist" or "rose". Icon is inline SVG markup. type Entry struct { ID string `json:"id"` Name string `json:"name"` Summary string `json:"summary"` Tint string `json:"tint"` Icon string `json:"icon"` Default bool `json:"default"` } //go:embed catalog.json var raw []byte var entries = mustLoad() func mustLoad() []Entry { var e []Entry if err := json.Unmarshal(raw, &e); err != nil { panic("catalog: bad catalog.json: " + err.Error()) } return e } // All returns the catalogue in display order. The caller may modify the copy. func All() []Entry { return append([]Entry(nil), entries...) } // Get returns the entry with the given ID. func Get(id string) (Entry, bool) { for _, e := range entries { if e.ID == id { return e, true } } return Entry{}, false }