Werdna has uploaded a new change for review. https://gerrit.wikimedia.org/r/202695
Change subject: Make the location of sitematrix.json configurable ...................................................................... Make the location of sitematrix.json configurable Change-Id: I02b0c56fff8dbd396fa515b8b6711f61ec944c3f --- M api/localsettings.js.example M lib/mediawiki.ParsoidConfig.js 2 files changed, 10 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/95/202695/1 diff --git a/api/localsettings.js.example b/api/localsettings.js.example index 99e3a54..a6679f0 100644 --- a/api/localsettings.js.example +++ b/api/localsettings.js.example @@ -18,6 +18,10 @@ // 'enwikivoyage' etc. (default true) //parsoidConfig.loadWMF = false; + // If you are using the above setting, you can also specify the path + // of the sitematrix.json file to load wikis from. + //parsoidConfig.wmfConfigPath = './sitematrix.json'; + // A default proxy to connect to the API endpoints. Default: undefined // (no proxying). Overridden by per-wiki proxy config in setInterwiki. //parsoidConfig.defaultAPIProxyURI = 'http://proxy.example.org:8080'; diff --git a/lib/mediawiki.ParsoidConfig.js b/lib/mediawiki.ParsoidConfig.js index 561db50..006fd4f 100644 --- a/lib/mediawiki.ParsoidConfig.js +++ b/lib/mediawiki.ParsoidConfig.js @@ -7,8 +7,7 @@ require('./core-upgrade.js'); var url = require('url'), Cite = require('./ext.Cite.js').Cite, - Util = require('./mediawiki.Util.js').Util, - sitematrix = require('./sitematrix.json').sitematrix; + Util = require('./mediawiki.Util.js').Util; /** @@ -28,10 +27,13 @@ this.reverseIWMap = new Map(); this.apiProxies = new Map(); this.interwikiRegexp = ""; + this.wmfConfigPath = './sitematrix.json'; if ( localSettings && localSettings.setup ) { localSettings.setup( this ); } + + this.sitematrix = require(this.wmfConfigPath); // Don't freak out! // This happily overwrites inherited properties. @@ -274,8 +276,8 @@ // of null / undefined in setInterwiki. var self = this; - Object.keys( sitematrix ).forEach(function( key ) { - var val = sitematrix[key]; + Object.keys( this.sitematrix ).forEach(function( key ) { + var val = this.sitematrix[key]; if ( !Number.isNaN( Number(key) ) ) { val.site.forEach(insertInMaps.bind(self, undefined)); } else if ( key === "specials" ) { -- To view, visit https://gerrit.wikimedia.org/r/202695 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I02b0c56fff8dbd396fa515b8b6711f61ec944c3f Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: Werdna <agarr...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits