From 591639e570ffc3a2f0abaf96ffa6f6789b39779f Mon Sep 17 00:00:00 2001 From: PrivateGER Date: Fri, 26 May 2023 10:12:52 +0200 Subject: [PATCH] Add ssl option to MeiliSearch config --- .config/example.yml | 1 + packages/backend/src/config/types.ts | 2 +- packages/backend/src/db/meilisearch.ts | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.config/example.yml b/.config/example.yml index 0f2eecf90..3b35778fa 100644 --- a/.config/example.yml +++ b/.config/example.yml @@ -87,6 +87,7 @@ redis: #meilisearch: # host: meilisearch # port: 7700 +# ssl: false # apiKey: # ┌───────────────┐ diff --git a/packages/backend/src/config/types.ts b/packages/backend/src/config/types.ts index b6a449f54..e61ef85ae 100644 --- a/packages/backend/src/config/types.ts +++ b/packages/backend/src/config/types.ts @@ -39,11 +39,11 @@ export type Source = { collection?: string; bucket?: string; }; - meilisearch: { host: string; port: number; apiKey?: string; + ssl: boolean }; proxy?: string; diff --git a/packages/backend/src/db/meilisearch.ts b/packages/backend/src/db/meilisearch.ts index 75d584f8a..a58425c54 100644 --- a/packages/backend/src/db/meilisearch.ts +++ b/packages/backend/src/db/meilisearch.ts @@ -20,9 +20,10 @@ const hasConfig = const host = hasConfig ? config.meilisearch.host ?? "localhost" : ""; const port = hasConfig ? config.meilisearch.port ?? 7700 : 0; const auth = hasConfig ? config.meilisearch.apiKey ?? "" : ""; +const ssl = hasConfig ? config.meilisearch.ssl ?? false : false; const client: MeiliSearch = new MeiliSearch({ - host: `http://${host}:${port}`, + host: `${ssl ? "https" : "http"}://${host}:${port}`, apiKey: auth, });