From fb10510dc4292de3a045f0fea52a490caa73203e Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Sun, 5 Jul 2020 02:01:32 -0400 Subject: [PATCH] Add External Data extension, with config for SnipeIT --- Dockerfile | 5 +++++ LocalSettings.php | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/Dockerfile b/Dockerfile index e718b0d..b395cc3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -67,3 +67,8 @@ RUN git clone --depth 1 -b $MEDIAWIKI_BRANCH \ RUN git clone --depth 1 -b $MEDIAWIKI_BRANCH \ https://gerrit.wikimedia.org/r/mediawiki/extensions/TemplateData \ /var/www/html/extensions/TemplateData + +# https://www.mediawiki.org/wiki/Extension:External_Data +RUN git clone --depth 1 \ + https://gerrit.wikimedia.org/r/mediawiki/extensions/ExternalData \ + /var/www/html/extensions/ExternalData diff --git a/LocalSettings.php b/LocalSettings.php index a0745b7..bed02d9 100644 --- a/LocalSettings.php +++ b/LocalSettings.php @@ -227,3 +227,17 @@ $wgVirtualRestConfig['modules']['parsoid'] = array( wfLoadExtension( 'TemplateData' ); require_once "$IP/extensions/Widgets/Widgets.php"; + +wfLoadExtension( 'ExternalData' ); +$edgStringReplacements['SNIPEIT_URL'] = 'https://inventory.claremontmakerspace.org'; +$edgAllowExternalDataFrom = 'SNIPEIT_URL'; +// TODO: Use ExternalDataBeforeWebCall to set the headers only for +// snipeit API calls. Only matters if other domains are added to +// the whitelist. +$edgHTTPOptions = [ + 'headers' => [ + 'Accept' => 'application/json', + 'Content-Type' => 'application/json', + 'Authorization' => 'Bearer '.$secrets['SnipeITAPIKey'] + ] +];