Skip to content

Commit 187ef7e

Browse files
committed
Add attr option to /data HTTP request
1 parent abb0157 commit 187ef7e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

handlers.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,16 @@ func DataLocationHandler(c *gin.Context) {
3434
return
3535
}
3636

37+
// by default use DataLocationAttributes as list of meta-data record attributes to lookup
38+
// but if HTTP request provide concrete attribute switch to it
39+
locationAttributes := srvConfig.Config.CHESSMetaData.DataLocationAttributes
40+
attr := c.Query("attr")
41+
if attr != "" {
42+
locationAttributes = append(locationAttributes, attr)
43+
}
44+
3745
// Extract data location from metadata record
38-
for _, attr := range srvConfig.Config.CHESSMetaData.DataLocationAttributes {
46+
for _, attr := range locationAttributes {
3947
if val, ok := meta[attr]; ok {
4048
// if location attribute (raw data location) is found redirect to it
4149
path := val.(string)

0 commit comments

Comments
 (0)