mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00

Look, this will make the git history look funny, but trimming unnecessary depth from the source tree is a very necessary sanity-preserving measure when dealing with a super-modularized codebase like this one. While it makes the project configuration a bit less conventional, it will save you several clicks every time you jump between modules. Which you'll do a lot, because it's *modul*ar. The src/main/java convention makes a lot of sense for a non-modular project though. This ain't that.
36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
package nu.marginalia.search;
|
|
|
|
import com.google.inject.AbstractModule;
|
|
import com.google.inject.Provides;
|
|
import nu.marginalia.LanguageModels;
|
|
import nu.marginalia.WebsiteUrl;
|
|
import nu.marginalia.WmsaHome;
|
|
import nu.marginalia.model.gson.GsonFactory;
|
|
import nu.marginalia.renderer.config.HandlebarsConfigurator;
|
|
import nu.marginalia.feedlot.FeedlotClient;
|
|
|
|
import java.time.Duration;
|
|
|
|
public class SearchModule extends AbstractModule {
|
|
|
|
public void configure() {
|
|
bind(HandlebarsConfigurator.class).to(SearchHandlebarsConfigurator.class);
|
|
|
|
bind(LanguageModels.class).toInstance(WmsaHome.getLanguageModels());
|
|
|
|
bind(WebsiteUrl.class).toInstance(new WebsiteUrl(
|
|
System.getProperty("search.websiteUrl", "https://search.marginalia.nu/")));
|
|
}
|
|
|
|
@Provides
|
|
public FeedlotClient provideFeedlotClient() {
|
|
return new FeedlotClient(
|
|
System.getProperty("ext-svc-feedlot-bindAddress", "feedlot"),
|
|
Integer.getInteger("ext-svc-feedlot-port", 80),
|
|
GsonFactory.get(),
|
|
Duration.ofMillis(250),
|
|
Duration.ofMillis(100)
|
|
);
|
|
}
|
|
}
|