diff --git a/CHANGELOG.md b/CHANGELOG.md index c16db4b4a..0baf1fec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All changes that impact users of this module are documented in this file, in the [Common Changelog](https://common-changelog.org) format with some additional specifications defined in the CONTRIBUTING file. This codebase adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased [patch] + +> Development of this release was supported by the [French Ministry for Foreign Affairs](https://www.diplomatie.gouv.fr/fr/politique-etrangere-de-la-france/diplomatie-numerique/) through its ministerial [State Startups incubator](https://beta.gouv.fr/startups/open-terms-archive.html) under the aegis of the Ambassador for Digital Affairs. + +### Fixed + +- Validate presence of required configuration for dataset publication to data.gouv.fr + ## 10.1.2 - 2025-12-09 _Full changeset and discussions: [#1212](https://github.com/OpenTermsArchive/engine/pull/1212)._ diff --git a/config/default.json b/config/default.json index 3cac8ea15..95dab61cd 100644 --- a/config/default.json +++ b/config/default.json @@ -56,8 +56,6 @@ } }, "dataset": { - "title": "Sandbox collection dataset", - "versionsRepositoryURL": "https://github.com/OpenTermsArchive/sandbox-declarations", "publishingSchedule": "30 8 * * MON" } } diff --git a/scripts/dataset/publish/datagouv/index.js b/scripts/dataset/publish/datagouv/index.js index c41cf7f41..98f49cff1 100644 --- a/scripts/dataset/publish/datagouv/index.js +++ b/scripts/dataset/publish/datagouv/index.js @@ -41,11 +41,21 @@ function loadConfiguration() { const organizationIdOrSlug = config.has('@opentermsarchive/engine.dataset.datagouv.organizationIdOrSlug') && config.get('@opentermsarchive/engine.dataset.datagouv.organizationIdOrSlug'); if (!datasetId && !organizationIdOrSlug) { - throw new Error('Either datasetId or organizationIdOrSlug is required in config at @opentermsarchive/engine.dataset.datagouv'); + throw new Error('Either "datasetId" or "organizationIdOrSlug" is required in config at @opentermsarchive/engine.dataset.datagouv'); } const datasetTitle = config.get('@opentermsarchive/engine.dataset.title'); + + if (!datasetTitle) { + throw new Error('"title" is required in config at @opentermsarchive/engine.dataset'); + } + const frequency = config.has('@opentermsarchive/engine.dataset.datagouv.frequency') && config.get('@opentermsarchive/engine.dataset.datagouv.frequency'); + + if (!frequency) { + throw new Error('"frequency" is required in config at @opentermsarchive/engine.dataset.datagouv'); + } + const useDemo = config.has('@opentermsarchive/engine.dataset.datagouv.useDemo') && config.get('@opentermsarchive/engine.dataset.datagouv.useDemo'); const apiBaseUrl = useDemo ? DEMO_API_BASE_URL : PRODUCTION_API_BASE_URL; diff --git a/scripts/dataset/publish/index.js b/scripts/dataset/publish/index.js index 79f752a12..ec8906173 100644 --- a/scripts/dataset/publish/index.js +++ b/scripts/dataset/publish/index.js @@ -1,5 +1,3 @@ -import config from 'config'; - import logger from '../logger/index.js'; import publishDataGouv from './datagouv/index.js'; @@ -16,7 +14,7 @@ export default async function publishRelease({ archivePath, releaseDate, stats } platforms.push({ name: 'GitLab', publish: () => publishGitLab({ archivePath, releaseDate, stats }) }); } - if (process.env.OTA_ENGINE_DATAGOUV_API_KEY && (config.has('@opentermsarchive/engine.dataset.datagouv.datasetId') || config.has('@opentermsarchive/engine.dataset.datagouv.organizationIdOrSlug'))) { + if (process.env.OTA_ENGINE_DATAGOUV_API_KEY) { platforms.push({ name: 'data.gouv.fr', publish: () => publishDataGouv({ archivePath, releaseDate, stats }) }); }