Skip to content

Commit

Permalink
prevent crash if elastic search not configured
Browse files Browse the repository at this point in the history
  • Loading branch information
kadamidev committed Aug 7, 2024
1 parent 0e04fa6 commit 59b5074
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions desci-server/src/elasticSearchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ if (!esNodeUrl || !esUser || !esPw) {
console.error('Missing environment variables for ElasticSearch');
}

const esAuthConfig = !esNodeUrl?.includes('host.docker.internal')
? {
// Auth unnecessary if running local ES node
auth: {
username: esUser,
password: esPw,
},
}
: {};
const esAuthConfig =
!esNodeUrl?.includes('host.docker.internal') && esUser && esPw
? {
// Auth unnecessary if running local ES node
auth: {
username: esUser,
password: esPw,
},
}
: {};

export const elasticClient =
esNodeUrl && esUser && esPw
Expand Down

0 comments on commit 59b5074

Please sign in to comment.