11from __future__ import annotations
22
3+ from dandischema .conf import get_instance_config
34from django .conf import settings
45from django .urls import reverse
56from drf_yasg .utils import no_body , swagger_auto_schema
910
1011from dandiapi import __version__
1112
13+ _INSTANCE_CONFIG = get_instance_config ()
14+
1215
1316def 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