Skip to content

Commit

Permalink
add /api/server/note endpoint and support in config TOML
Browse files Browse the repository at this point in the history
  • Loading branch information
DocSavage committed Apr 5, 2017
1 parent 5f8dd83 commit 8e27eea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config-full.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ webClient = "/path/to/webclient"
# to return Timing-Allow-Origin headers in response
# allowTiming = true

note = "you can put anything you want in here and have it available via /api/server/note"

# How new data instance ids are generated.
# Is one of "random" or "sequential". If "sequential" can set "start_instance_id" property.
# Use of "random" is a cheap way to have multiple frontend DVIDs use a shared store without
Expand Down
1 change: 1 addition & 0 deletions server/server_local.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ type serverConfig struct {
RPCAddress string
WebClient string
AllowTiming bool
Note string

IIDGen string `toml:"instance_id_gen"`
IIDStart uint32 `toml:"instance_id_start"`
Expand Down
11 changes: 11 additions & 0 deletions server/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ const WebHelp = `
Returns JSON for server properties.
GET /api/server/note
Returns any value of [server.note] from the configuration TOML.
GET /api/server/types
Returns JSON with the datatypes of currently stored data instances. Datatypes are represented
Expand Down Expand Up @@ -517,6 +521,8 @@ func initRoutes() {

mainMux.Get("/api/server/info", serverInfoHandler)
mainMux.Get("/api/server/info/", serverInfoHandler)
mainMux.Get("/api/server/note", serverNoteHandler)
mainMux.Get("/api/server/note/", serverNoteHandler)
mainMux.Get("/api/server/types", serverTypesHandler)
mainMux.Get("/api/server/types/", serverTypesHandler)
mainMux.Get("/api/server/compiled-types", serverCompiledTypesHandler)
Expand Down Expand Up @@ -932,6 +938,11 @@ func serverInfoHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, jsonStr)
}

func serverNoteHandler(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
fmt.Fprintf(w, tc.Server.Note)
}

func serverTypesHandler(w http.ResponseWriter, r *http.Request) {
jsonMap := make(map[dvid.TypeString]string)
typemap, err := datastore.Types()
Expand Down

0 comments on commit 8e27eea

Please sign in to comment.