mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 22:37:04 +08:00
chore(server): support elasticsearch apiKey (#12405)
This commit is contained in:
@@ -248,7 +248,9 @@ export class ElasticsearchProvider extends SearchProvider {
|
||||
const headers = {
|
||||
'Content-Type': contentType,
|
||||
} as Record<string, string>;
|
||||
if (this.config.provider.password) {
|
||||
if (this.config.provider.apiKey) {
|
||||
headers.Authorization = `ApiKey ${this.config.provider.apiKey}`;
|
||||
} else if (this.config.provider.password) {
|
||||
headers.Authorization = `Basic ${Buffer.from(`${this.config.provider.username}:${this.config.provider.password}`).toString('base64')}`;
|
||||
}
|
||||
const response = await fetch(url, {
|
||||
|
||||
Reference in New Issue
Block a user