Skip to content

Commit

Permalink
[BIO-6368] configured DOI (#7)
Browse files Browse the repository at this point in the history
* [BIO-6368] configured DOI

* [BIO-6368]
  - Updated doi extension to latest tag
  - Fixed `02_setup-dbca.sh` to get CKAN plugins from the dbca.ini config file and use this file in init db commands
  - Updated dbca.ini to use new config value `ckanext.doi.language` and revert back to `en_AU` as the ckan locale default

---------

Co-authored-by: Mark Calvert <markcalvert84@gmail.com>
  • Loading branch information
awset and MarkCalvert authored Jan 11, 2024
1 parent b1cd9eb commit 32f3f6f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .env.dbca
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ NGINX_SSLPORT=443

# Extensions

## ckanext-doi ##
CKANEXT__DOI__ACCOUNT_NAME=
CKANEXT__DOI__ACCOUNT_PASSWORD=

## WA DBCA Config ##
# Docker compose project name
COMPOSE_PROJECT_NAME=dbca
Expand Down
8 changes: 7 additions & 1 deletion ckan/config/dbca.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use = config:/srv/app/ckan.ini
ckan.devserver.watch_patterns = /srv/app/ckan.ini

## Plugins Settings ############################################################
ckan.plugins = image_view text_view datatables_view pdf_view datastore xloader pages showcase hierarchy_display hierarchy_form hierarchy_group_form dcat dbca scheming_datasets spatial_metadata spatial_query envvars
ckan.plugins = image_view text_view datatables_view pdf_view datastore xloader pages showcase hierarchy_display hierarchy_form hierarchy_group_form dcat dbca scheming_datasets spatial_metadata spatial_query doi envvars

## Resource Views Settings #####################################################
ckan.views.default_views = text_view datatables_view pdf_view
Expand All @@ -30,6 +30,12 @@ ckanext.spatial.common_map.type = custom
# ckanext-scheming
scheming.dataset_schemas = ckanext.dbca:dbca_dataset.yaml

# ckanext-doi
ckanext.doi.publisher = Department of Biodiversity, Conservation and Attractions
ckanext.doi.prefix = 10.82800
ckanext.doi.test_mode = True
ckanext.doi.language = en

## CKAN Extensions configuration ###############################################

## Logging configuration
Expand Down
13 changes: 12 additions & 1 deletion ckan/docker-entrypoint.d/02_setup_dbca.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
#!/bin/bash

# Get the ckan plugins values from the DBCA CKAN config file
CKAN__PLUGINS=$(grep '^ckan\.plugins' $APP_DIR/config/dbca.ini | cut -d'=' -f2)
echo "CKAN__PLUGINS: $CKAN__PLUGINS"

if [[ $CKAN__PLUGINS == *"xloader"* ]]; then
# Add ckan.xloader.api_token to the CKAN config file (updated with corrected value later)
echo "Setting a temporary value for ckanext.xloader.api_token"
ckan config-tool $CKAN_INI "ckanext.xloader.api_token=$(ckan -c $CKAN_INI user token add $CKAN_SYSADMIN_NAME xloader | tail -n 1 | tr -d '\t')"
fi

# Use the DBCA CKAN config file for the CKAN config file
CKAN_INI=$APP_DIR/config/dbca.ini

## Examples of how to initialise DB for the extensions
# if [[ $CKAN__PLUGINS == *"archiver"* ]]; then
# ckan -c $CKAN_INI archiver init
Expand All @@ -21,4 +28,8 @@ fi

if [[ $CKAN__PLUGINS == *"pages"* ]]; then
ckan -c $CKAN_INI pages initdb
fi
fi

if [[ $CKAN__PLUGINS == *"doi"* ]]; then
ckan -c $CKAN_INI doi initdb
fi
2 changes: 1 addition & 1 deletion ckan/setup/dbca_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ pip3 install -r ${SRC_DIR}/ckanext-xloader/requirements.txt

# 3rd Party #
# DOI
pip3 install -e git+https://github.com/NaturalHistoryMuseum/ckanext-doi@v3.1.9#egg=ckanext-doi
pip3 install -e git+https://github.com/NaturalHistoryMuseum/ckanext-doi@v3.1.10#egg=ckanext-doi

0 comments on commit 32f3f6f

Please sign in to comment.