Skip to content

Commit

Permalink
Take Kobo configuration from environment
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-misuk-im committed Dec 3, 2024
1 parent aa21574 commit 202bccf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/country_workspace/config/fragments/kobo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .. import env

KOBO_BASE_URL = env("KOBO_BASE_URL")
KOBO_TOKEN = env("KOBO_TOKEN")
1 change: 1 addition & 0 deletions src/country_workspace/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@
from .fragments.rest_framework import * # noqa
from .fragments.root import * # noqa
from .fragments.sentry import * # noqa
from .fragments.kobo import * # noqa

# from .fragments.smart_admin import * # noqa
from .fragments.social_auth import * # noqa
Expand Down
4 changes: 2 additions & 2 deletions src/country_workspace/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import logging
from typing import TYPE_CHECKING, Any

from constance import config
from django.core.cache import cache

import sentry_sdk
from redis_lock import Lock

Expand Down Expand Up @@ -67,7 +67,7 @@ def removed_expired_jobs(**kwargs):
@app.task
def sync_kobo_assets_task(job_id: int, version: int) -> None:
_ = KoboSyncJob.objects.get(pk=job_id, version=version)
client = KoboClient(base_url="https://kf-hope-stg.unitst.org", token="01f1a122ddad12d7e72f3b86e9d8a637c917bee8")
client = KoboClient(base_url=config.KOBO_BASE_URL, token=config.KOBO_TOKEN)
for asset_data in client.assets:
asset_model, _ = KoboAsset.objects.update_or_create(uid=asset_data.uid, defaults={"name": asset_data.name})

Expand Down

0 comments on commit 202bccf

Please sign in to comment.