Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/backend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ jobs:
run: |
tox -e ${{ matrix.tox-env }}
env:
DANDI_INSTANCE_NAME: DANDI
DANDI_DOI_PREFIX: "10.80507"
DJANGO_DATABASE_URL: postgres://postgres:postgres@localhost:5432/django
DJANGO_MINIO_STORAGE_ENDPOINT: localhost:9000
DJANGO_MINIO_STORAGE_ACCESS_KEY: minioAccessKey
Expand Down
1 change: 1 addition & 0 deletions dandiapi/api/tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def test_rest_info(api_client):
schema_url = f'http://{TEST_SERVER_NAME}{reverse("schema-dandiset-latest")}'

assert resp.json() == {
'instance_config': {'instance_name': 'DANDI', 'doi_prefix': '10.80507'},
'schema_version': settings.DANDI_SCHEMA_VERSION,
'schema_url': schema_url,
'version': __version__,
Expand Down
13 changes: 13 additions & 0 deletions dandiapi/api/views/info.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

from dandischema.conf import get_instance_config
from django.conf import settings
from django.urls import reverse
from drf_yasg.utils import no_body, swagger_auto_schema
Expand All @@ -9,6 +10,8 @@

from dandiapi import __version__

_INSTANCE_CONFIG = get_instance_config()


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

# Instance Configuration
instance_config = serializers.JSONField()

# Schema
schema_version = serializers.CharField()
schema_url = serializers.URLField()
Expand All @@ -61,6 +67,13 @@ def info_view(request):
api_url = f'{settings.DANDI_API_URL}/api'
serializer = ApiInfoSerializer(
data={
'instance_config': _INSTANCE_CONFIG.model_dump(
# Not excluding any `None` values in this object because the `None` values are
# needed to set the instance configuration in dandi-cli properly since
# a corresponding environment variable is used to set the instance configuration if
# the argument for a particular field is not provided.
mode='json'
),
'schema_version': settings.DANDI_SCHEMA_VERSION,
'schema_url': get_schema_url(request),
'version': __version__,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
'celery',
'dandi',
# Pin dandischema to exact version to make explicit which schema version is being used
'dandischema==0.11.0', # schema version 0.6.9
'dandischema @ git+https://github.com/dandi/dandi-schema.git@devendorize',
'django~=4.2.0',
# Pin to version where this bug is fixed
# https://codeberg.org/allauth/django-allauth/issues/4072
Expand Down
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ commands =

[testenv:test]
passenv =
DANDI_*
DJANGO_CELERY_BROKER_URL
DJANGO_DATABASE_URL
DJANGO_MINIO_STORAGE_ACCESS_KEY
Expand All @@ -58,6 +59,7 @@ commands =
setenv =
DJANGO_CONFIGURATION = TestingConfiguration
passenv =
DANDI_*
DJANGO_CELERY_BROKER_URL
DJANGO_DATABASE_URL
DJANGO_MINIO_STORAGE_ACCESS_KEY
Expand Down
Loading