Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom registration fields for registry #675

Merged
merged 13 commits into from
Jan 31, 2024
Merged
41 changes: 39 additions & 2 deletions docs/parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ description: >-
```

Note the following requirements:
- "name" must be snake case with underline connecting words, i.e. site_name.
- "name" must be snake case with underline connecting words, i.e. site_name.
- "type" must be one of "string", "int", "bool", "datetime" (Unix time in seconds), or "enum".
- "options" must be a non-empty yaml array for field with type "enum". "optionsUrl" will be ignored if "options" is set.
example:
Expand All @@ -645,7 +645,7 @@ description: >-
}
]
```
- "validationUrl" is an optional, user-provided validation endpoint
- "validationUrl" is an optional, user-provided validation endpoint
that listens to a POST request with JSON body of {"field": "<field value>"}
and responds with a 200 code and JSON of {"valid": bool, "message": ""}. If it's non-empty,
for all create and update of namespace registration, this URL will be called
Expand All @@ -655,6 +655,43 @@ type: object
default: none
components: ["nsregistry"]
---
name: Registry.InstitutionsUrl
turetske marked this conversation as resolved.
Show resolved Hide resolved
description: >-
A url to get a list of available institutions for users to register their namespaces to.
The url must accept a GET request with 200 response in JSON/YAML content with the following format:

JSON:
```JSON
[
{
"name": "University of Wisconsin - Madison",
"id": " https://osg-htc.org/iid/01y2jtd41"
}
]
```

YAML:
```yaml
---
- name: University of Wisconsin - Madison
id: " https://osg-htc.org/iid/01y2jtd41"
```

where the id field will be stored in registry database and must be unique, and name field will be displayed in UI as the option.

Note that Pelican will cache the response of the url in a TTL cache with default refresh time of 15 minutes.
Also note that Registry.Institutions will take precedence over this value if both are set.
type: url
default: none
components: ["nsregistry"]
---
name: Registry.InstitutionsUrlReloadMinutes
description: >-
Number of minutes that the Registry.InstitutionsUrl will be reloaded into the TTL cache.
type: duration
default: 15m
components: ["nsregistry"]
---
############################
# Server-level configs #
############################
Expand Down
2 changes: 2 additions & 0 deletions registry/registry_ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ const (
var (
registrationFields []registrationField
customRegFieldsConfigs []customRegFieldsConfig
institutionsCache *ttlcache.Cache[string, []Institution]
institutionsCacheMutex = sync.RWMutex{}
)

func init() {
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.