From a50909b32b11ccc7863c9217f7ff92687a4cdf64 Mon Sep 17 00:00:00 2001 From: Pan Luo Date: Fri, 10 Jul 2026 21:45:32 -0700 Subject: [PATCH] Allow overriding the OPL metadata release API URL The download-OPL-metadata-release.pl script hardcodes the GitHub API URL used to locate the latest OPL metadata release. Sites that maintain a fork of the webwork-open-problem-library (for example, with local problem metadata) cannot use the script to download their own metadata releases. Allow the URL to be overridden by setting the OPL_METADATA_RELEASE_API_URL environment variable, and fall back to the existing openwebwork URL when the variable is not set. The rest of the fetch and restore logic is unchanged. --- bin/download-OPL-metadata-release.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/download-OPL-metadata-release.pl b/bin/download-OPL-metadata-release.pl index 244415a79e..a86d09d436 100755 --- a/bin/download-OPL-metadata-release.pl +++ b/bin/download-OPL-metadata-release.pl @@ -32,8 +32,10 @@ BEGIN die "The WeBWorK temporary directory $ce->{webworkDirs}{tmp} does not exist or is not writable." if (!-d $ce->{webworkDirs}{tmp} || !-w $ce->{webworkDirs}{tmp}); -my $releaseDataFF = - File::Fetch->new(uri => 'https://api.github.com/repos/openwebwork/webwork-open-problem-library/releases/latest'); +# Set the OPL_METADATA_RELEASE_API_URL environment variable to override the release API URL, +# for example, for sites that use a fork of the OPL. +my $releaseDataFF = File::Fetch->new(uri => $ENV{OPL_METADATA_RELEASE_API_URL} + // 'https://api.github.com/repos/openwebwork/webwork-open-problem-library/releases/latest'); my $file = $releaseDataFF->fetch(to => $ce->{webworkDirs}{tmp}) or die $releaseDataFF->error; my $path = Mojo::File->new($file); my $releaseData = decode_json($path->slurp);