mirror of
https://git.burble.com/burble.dn42/dn42regsrv.git
synced 2024-02-26 20:28:04 +01:00
Add api/registry/.meta endpoint
This commit is contained in:
parent
b9de311c36
commit
cdba1d94f7
17
API.md
17
API.md
@ -383,6 +383,23 @@ wget -O - -q http://localhost:8042/api/registry/aut-num/*/*-c/*burble?raw | jq
|
||||
}
|
||||
```
|
||||
|
||||
A special query exists to return metadata about the registry
|
||||
|
||||
```
|
||||
GET /api/registry/.meta
|
||||
```
|
||||
|
||||
Example Output (JSON format):
|
||||
```
|
||||
wget -O - -q http://localhost:8042/api/dns/.meta | jq
|
||||
```
|
||||
|
||||
```
|
||||
{
|
||||
"Commit": "fa89d022d0c2a48bcfbee405e2f3685f3b9cf063"
|
||||
}
|
||||
```
|
||||
|
||||
## DNS Root Zone API
|
||||
|
||||
The DNS API provides a list of resource records that can be used to create a root zone for DN42
|
||||
|
20
regapi.go
20
regapi.go
@ -15,6 +15,13 @@ import (
|
||||
// "time"
|
||||
)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// data structures
|
||||
|
||||
type RegMetaReturn struct {
|
||||
Commit string
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// register the api
|
||||
|
||||
@ -38,6 +45,7 @@ func InitRegistryAPI(params ...interface{}) {
|
||||
//s.HandleFunc("/.schema", rTypeListHandler)
|
||||
//s.HandleFunc("/.meta/", rTypeListHandler)
|
||||
|
||||
s.HandleFunc("/.meta", regMetaHandler)
|
||||
s.HandleFunc("/{type}", regTypeHandler)
|
||||
s.HandleFunc("/{type}/{object}", regObjectHandler)
|
||||
s.HandleFunc("/{type}/{object}/{key}", regKeyHandler)
|
||||
@ -46,6 +54,18 @@ func InitRegistryAPI(params ...interface{}) {
|
||||
log.Info("Registry API installed")
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// return registry metadata
|
||||
|
||||
func regMetaHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
rv := RegMetaReturn{
|
||||
Commit: RegistryData.Commit,
|
||||
}
|
||||
|
||||
ResponseJSON(w, rv)
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// filter functions
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user