feat: hide registration button when disabled (#287)

* add allow registration to API Summary

* code gen

* use env for troubleshooting

* disable registration toggle based on backend
This commit is contained in:
Hayden 2023-02-15 08:58:38 -09:00 committed by GitHub
parent dd349aa98e
commit efd7069fe4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 14 deletions

View file

@ -44,12 +44,13 @@ type (
}
ApiSummary struct {
Healthy bool `json:"health"`
Versions []string `json:"versions"`
Title string `json:"title"`
Message string `json:"message"`
Build Build `json:"build"`
Demo bool `json:"demo"`
Healthy bool `json:"health"`
Versions []string `json:"versions"`
Title string `json:"title"`
Message string `json:"message"`
Build Build `json:"build"`
Demo bool `json:"demo"`
AllowRegistration bool `json:"allowRegistration"`
}
)
@ -82,11 +83,12 @@ func NewControllerV1(svc *services.AllServices, repos *repo.AllRepos, options ..
func (ctrl *V1Controller) HandleBase(ready ReadyFunc, build Build) server.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) error {
return server.Respond(w, http.StatusOK, ApiSummary{
Healthy: ready(),
Title: "Go API Template",
Message: "Welcome to the Go API Template Application!",
Build: build,
Demo: ctrl.isDemo,
Healthy: ready(),
Title: "Go API Template",
Message: "Welcome to the Go API Template Application!",
Build: build,
Demo: ctrl.isDemo,
AllowRegistration: ctrl.allowRegistration,
})
}
}

View file

@ -2425,6 +2425,9 @@ const docTemplate = `{
"v1.ApiSummary": {
"type": "object",
"properties": {
"allowRegistration": {
"type": "boolean"
},
"build": {
"$ref": "#/definitions/v1.Build"
},

View file

@ -2417,6 +2417,9 @@
"v1.ApiSummary": {
"type": "object",
"properties": {
"allowRegistration": {
"type": "boolean"
},
"build": {
"$ref": "#/definitions/v1.Build"
},

View file

@ -564,6 +564,8 @@ definitions:
type: object
v1.ApiSummary:
properties:
allowRegistration:
type: boolean
build:
$ref: '#/definitions/v1.Build'
demo: