08c0b7a2fd
* Refactor error usage from the store level up and add API helpers * Complete API tests * Fix merge errorResponse calls * Remove ensure helpers to allow for custom messages on permission errors * Fix bad import and call * Remove bad user check on auth that was added as part of the main merge * Fix empty list test * Replace deprecated proxy calls to ioutil.ReadAll with io.ReadAll * Add information to the NotFound errors * Add context to all remaining errors and address review comments * Fix linter * Adapt the new card API endpoints to the error refactor * Remove almost all customErrorResponse calls * Add request entity too large to errorResponse and remove customErrorResponse * Fix linter
41 lines
869 B
Go
41 lines
869 B
Go
package api
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/gorilla/mux"
|
|
)
|
|
|
|
func (a *API) registerConfigRoutes(r *mux.Router) {
|
|
// Config APIs
|
|
r.HandleFunc("/clientConfig", a.getClientConfig).Methods("GET")
|
|
}
|
|
|
|
func (a *API) getClientConfig(w http.ResponseWriter, r *http.Request) {
|
|
// swagger:operation GET /clientConfig getClientConfig
|
|
//
|
|
// Returns the client configuration
|
|
//
|
|
// ---
|
|
// produces:
|
|
// - application/json
|
|
// responses:
|
|
// '200':
|
|
// description: success
|
|
// schema:
|
|
// "$ref": "#/definitions/ClientConfig"
|
|
// default:
|
|
// description: internal error
|
|
// schema:
|
|
// "$ref": "#/definitions/ErrorResponse"
|
|
|
|
clientConfig := a.app.GetClientConfig()
|
|
|
|
configData, err := json.Marshal(clientConfig)
|
|
if err != nil {
|
|
a.errorResponse(w, r, err)
|
|
return
|
|
}
|
|
jsonBytesResponse(w, http.StatusOK, configData)
|
|
}
|