make instance_info more closesly resemble spec

trunk
vilmibm 2022-05-02 15:32:40 -05:00
parent 3ed669f560
commit d22be08044
1 changed files with 12 additions and 2 deletions

View File

@ -189,9 +189,19 @@ func writeErrorResponse(w http.ResponseWriter, code int, resp BBJResponse) {
func setupAPI(opts Opts) {
http.HandleFunc("/instance", handler(opts, func(w http.ResponseWriter, req *http.Request) {
http.HandleFunc("/instance_info", handler(opts, func(w http.ResponseWriter, req *http.Request) {
type instanceInfo struct {
InstanceName string `json:"instance_name"`
AllowAnon bool `json:"allow_anon"`
Admins []string
}
writeResponse(w, BBJResponse{
Data: opts.Config.InstanceName,
Data: instanceInfo{
InstanceName: opts.Config.InstanceName,
AllowAnon: opts.Config.AllowAnon,
Admins: opts.Config.Admins,
},
})
}))