Merge "Development: Allow us to test search with different API hosts"
This commit is contained in:
commit
a9b47f57fb
|
@ -35,6 +35,7 @@ class Hooks {
|
|||
Config $config
|
||||
) {
|
||||
return [
|
||||
'wgVectorSearchHost' => $config->get( 'VectorSearchHost' ),
|
||||
'wgVectorUseCoreSearch' => $config->get( 'VectorUseCoreSearch' ),
|
||||
];
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ interface MediaWiki {
|
|||
};
|
||||
Api: MwApiConstructor;
|
||||
config: {
|
||||
get( configKey: string|null ): string;
|
||||
get( configKey: string|null, fallback?: any|null ): string;
|
||||
set( configKey: string|null, value: any|null ): void;
|
||||
},
|
||||
loader: {
|
||||
/**
|
||||
|
|
|
@ -132,6 +132,11 @@ function initSearchLoader( document ) {
|
|||
var searchForm = document.getElementById( SEARCH_FORM_ID ),
|
||||
searchInput = document.getElementById( SEARCH_INPUT_ID );
|
||||
|
||||
// Allow developers to defined $wgVectorSearchHost in LocalSettings to target different APIs
|
||||
if ( config.wgVectorSearchHost ) {
|
||||
mw.config.set( 'wgVectorSearchHost', config.wgVectorSearchHost );
|
||||
}
|
||||
|
||||
if ( !searchForm || !searchInput ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ module.exports = {
|
|||
},
|
||||
domain: function () {
|
||||
// It might be helpful to allow this to be configurable in future.
|
||||
return location.host;
|
||||
return mw.config.get( 'wgVectorSearchHost', location.host );
|
||||
}
|
||||
},
|
||||
props: {
|
||||
|
|
Loading…
Reference in New Issue