Skip to content

Commit

Permalink
prevent crash if elastic envs not set
Browse files Browse the repository at this point in the history
  • Loading branch information
kadamidev committed Aug 7, 2024
1 parent ac73330 commit 0e04fa6
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions desci-server/src/elasticSearchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ const esAuthConfig = !esNodeUrl?.includes('host.docker.internal')
}
: {};

export const elasticClient = new Client({
node: esNodeUrl,

...esAuthConfig,
tls: {
rejectUnauthorized: false, // Temporary
},
});
export const elasticClient =
esNodeUrl && esUser && esPw
? new Client({
node: esNodeUrl,
...esAuthConfig,
tls: {
rejectUnauthorized: false, // Temporary
},
})
: ({} as any);

0 comments on commit 0e04fa6

Please sign in to comment.