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'] + ] +];