Skip to content

Conversation

mefogle
Copy link

@mefogle mefogle commented May 4, 2025

Updated the search service to use the Brave Search API if it finds an empty Bing key. The original format for results is preserved, allowing it to be used as a drop-in replacement. The template for the key file has also been updated with a placeholder for the Brave key.

An alternative would be to add a server-level config to select the search service - let me know if you'd like to do that instead,

…rave.com/app/documentation/web-search) if it finds an empty Bing key in the search service.  The original format for results is preserved, allowing it to be used as a drop-in replacement.  The template for the key file has also been updated with a placeholder for the Brave key.
@MaxMaeder
Copy link
Owner

MaxMaeder commented May 5, 2025

Thanks for the contribution man! We probably want some sort of common interface, and an easy way to get the configured search service. For example, this is what I'm prototyping out for multiple auth providers:

const selectProvider = (): AuthService => {
  switch ((process.env.AUTH_PROVIDER ?? "firebase") as "firebase" | "static") {
    case "static":
      return composeAuthService(new StaticAuthProvider(process.env.STATIC_USERS_FILE));
    case "firebase":
    default:
      return composeAuthService(new FirebaseAuthProvider());
  }
};

Sorry will have more time to dedicate to this after this week. Problem with the current solution is I can see it getting messy down the road.

Will note also my code can be very much improved. Ex: process.env.AUTH_PROVIDER assigned to variable first, and a error thrown if service invalid.

@mefogle
Copy link
Author

mefogle commented May 5, 2025

No, that totally makes sense if you're planning on each of the various services potentially having multiple providers. Once you have an established pattern I'd be happy to revise the PR accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants