Skip to content

Commit 21efb6b

Browse files
committed
feat: have the /info/ endpoint provide instance config info
1 parent 5110864 commit 21efb6b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

dandiapi/api/views/info.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
from dandischema.conf import get_instance_config
34
from django.conf import settings
45
from django.urls import reverse
56
from drf_yasg.utils import no_body, swagger_auto_schema
@@ -9,6 +10,8 @@
910

1011
from dandiapi import __version__
1112

13+
_INSTANCE_CONFIG = get_instance_config()
14+
1215

1316
def get_schema_url(request):
1417
"""Get the URL for the schema based on current server deployment."""
@@ -40,6 +43,9 @@ def __init__(self, *args, **kwargs):
4043
}
4144
)
4245

46+
# Instance Configuration
47+
instance_config = serializers.JSONField()
48+
4349
# Schema
4450
schema_version = serializers.CharField()
4551
schema_url = serializers.URLField()
@@ -61,6 +67,13 @@ def info_view(request):
6167
api_url = f'{settings.DANDI_API_URL}/api'
6268
serializer = ApiInfoSerializer(
6369
data={
70+
'instance_config': _INSTANCE_CONFIG.model_dump(
71+
# Not excluding any `None` values in this object because the `None` values are
72+
# needed to set the instance configuration in dandi-cli properly since
73+
# a corresponding environment variable is used to set the instance configuration if
74+
# the argument for a particular field is not provided.
75+
mode='json'
76+
),
6477
'schema_version': settings.DANDI_SCHEMA_VERSION,
6578
'schema_url': get_schema_url(request),
6679
'version': __version__,

0 commit comments

Comments
 (0)