Jonas Kress (WMDE) has uploaded a new change for review. https://gerrit.wikimedia.org/r/275554
Change subject: Introduce configuration file ...................................................................... Introduce configuration file Have a configuration file with different values for local development and deployment. Change-Id: Ie77ce169b611e80b51bb899568dd53e86acfb329 --- M .jshintrc M index.html A wikibase/config.js M wikibase/init.js 4 files changed, 39 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/wikidata/query/gui refs/changes/54/275554/1 diff --git a/.jshintrc b/.jshintrc index 9d53176..23506ba 100644 --- a/.jshintrc +++ b/.jshintrc @@ -37,6 +37,7 @@ "JSON": false, "QUnit": false, "sinon": false, - "L": false + "L": false, + "CONFIG": true } } diff --git a/index.html b/index.html index 55959f9..e37c35e 100644 --- a/index.html +++ b/index.html @@ -205,6 +205,7 @@ <script src="wikibase/queryService/api/Sparql.js"></script> <script src="wikibase/queryService/api/QuerySamples.js"></script> <script src="wikibase/queryService/RdfNamespaces.js"></script> + <script src="wikibase/config.js"></script> <script src="wikibase/init.js"></script> </body> </html> diff --git a/wikibase/config.js b/wikibase/config.js new file mode 100644 index 0000000..345c5b1 --- /dev/null +++ b/wikibase/config.js @@ -0,0 +1,31 @@ +/* exported CONFIG */ +var CONFIG = ( function ( window ) { + 'use strict'; + + var configLocal = { + api : { + sparql : { + uri : 'https://query.wikidata.org/bigdata/namespace/wdq/sparql' + } + } + }; + + var configDeploy = { + api : { + sparql : { + uri : '/bigdata/namespace/wdq/sparql' + } + } + }; + + var hostname = window.location.hostname.toLowerCase(); + + if( hostname === '' || + hostname === 'localhost' || + hostname === '127.0.0.1'){ + return configLocal; + } + + return configDeploy; + +} )( window ); \ No newline at end of file diff --git a/wikibase/init.js b/wikibase/init.js index 5948417..87c0fb8 100644 --- a/wikibase/init.js +++ b/wikibase/init.js @@ -1,8 +1,10 @@ -( function ( $ ) { +( function ( $, config ) { 'use strict'; $( document ).ready( function () { - new wikibase.queryService.ui.App( $( '.wikibase-queryservice ' ) ); + new wikibase.queryService.ui.App( $( '.wikibase-queryservice ' ), null, + new wikibase.queryService.api.Sparql( config.api.sparql.uri ) + ); } ); -} )( jQuery ); +} )( jQuery, CONFIG ); \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/275554 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie77ce169b611e80b51bb899568dd53e86acfb329 Gerrit-PatchSet: 1 Gerrit-Project: wikidata/query/gui Gerrit-Branch: master Gerrit-Owner: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits