backstage
217 строк · 6.7 Кб
1/*
2* Copyright 2021 The Backstage Authors
3*
4* Licensed under the Apache License, Version 2.0 (the "License");
5* you may not use this file except in compliance with the License.
6* You may obtain a copy of the License at
7*
8* http://www.apache.org/licenses/LICENSE-2.0
9*
10* Unless required by applicable law or agreed to in writing, software
11* distributed under the License is distributed on an "AS IS" BASIS,
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13* See the License for the specific language governing permissions and
14* limitations under the License.
15*/
16
17export interface Config {
18/** Configuration options for the search plugin */
19search?: {
20/**
21* Options for ElasticSearch
22*/
23elasticsearch?: {
24/**
25* Batch size for elastic search indexing tasks. Defaults to 1000.
26*/
27batchSize?: number;
28/**
29* Options for configuring highlight settings
30* See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/highlighting.html
31*/
32highlightOptions?: {
33/**
34* The size of the highlighted fragment in characters. Defaults to 1000.
35*/
36fragmentSize?: number;
37/**
38* Number of result fragments to extract. Fragments will be concatenated with `fragmentDelimiter`. Defaults to 1.
39*/
40numFragments?: number;
41/**
42* Delimiter string used to concatenate fragments. Defaults to " ... ".
43*/
44fragmentDelimiter?: string;
45};
46
47/** Elasticsearch specific index template bodies */
48indexTemplates?: Array<{
49name: string;
50body: {
51/**
52* Array of wildcard (*) expressions used to match the names of data streams and indices during creation.
53*/
54index_patterns: string[];
55
56/**
57* An ordered list of component template names.
58* Component templates are merged in the order specified,
59* meaning that the last component template specified has the highest precedence.
60*/
61composed_of?: string[];
62
63/**
64* See available properties of template
65* https://www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-put-template.html#put-index-template-api-request-body
66*/
67template?: {
68[key: string]: unknown;
69};
70};
71}>;
72
73/** Miscellaneous options for the client */
74clientOptions?: {
75ssl?: {
76/**
77* If true the server will reject any connection which is not
78* authorized with the list of supplied CAs.
79* @default true
80*/
81rejectUnauthorized?: boolean;
82};
83} & (
84| {
85// elastic = Elastic.co ElasticSearch provider
86provider: 'elastic';
87
88/**
89* Elastic.co CloudID
90* See: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-connecting.html#authentication
91*/
92cloudId: string;
93
94auth: {
95username: string;
96
97/**
98* @visibility secret
99*/
100password: string;
101};
102}
103
104/**
105* AWS = Amazon Elasticsearch Service provider
106*
107* Authentication is handled using the default AWS credentials provider chain
108*/
109| {
110provider: 'aws';
111
112/**
113* Node configuration.
114* URL AWS ES endpoint to connect to.
115* Eg. https://my-es-cluster.eu-west-1.es.amazonaws.com
116*/
117node: string;
118
119/**
120* The AWS region.
121* Only needed if using a custom DNS record.
122*/
123region?: string;
124
125/**
126* The AWS service used for request signature.
127* Either 'es' for "Managed Clusters" or 'aoss' for "Serverless".
128* Only needed if using a custom DNS record.
129*/
130service?: 'es' | 'aoss';
131}
132
133/**
134* Standard ElasticSearch
135*
136* Includes self-hosted clusters and others that provide direct connection via an endpoint
137* and authentication method (see possible authentication options below)
138*/
139| {
140/**
141* Node configuration.
142* URL/URLS to ElasticSearch node to connect to.
143* Either direct URL like 'https://localhost:9200' or with credentials like 'https://username:password@localhost:9200'
144*/
145node: string | string[];
146
147/**
148* Authentication credentials for ElasticSearch
149* If both ApiKey/Bearer token and username+password is provided, tokens take precedence
150*/
151auth?:
152| {
153username: string;
154
155/**
156* @visibility secret
157*/
158password: string;
159}
160| {
161/**
162* Base64 Encoded API key to be used to connect to the cluster.
163* See: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html
164*
165* @visibility secret
166*/
167apiKey: string;
168};
169/* TODO(kuangp): unsupported until @elastic/elasticsearch@7.14 is released
170| {
171
172/**
173* Bearer authentication token to connect to the cluster.
174* See: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-service-token.html
175*
176* @visibility secret
177*
178bearer: string;
179};*/
180}
181
182/**
183* AWS = In house hosting Open Search
184*/
185| {
186provider: 'opensearch';
187/**
188* Node configuration.
189* URL/URLS to OpenSearch node to connect to.
190* Either direct URL like 'https://localhost:9200' or with credentials like 'https://username:password@localhost:9200'
191*/
192node: string | string[];
193
194/**
195* Authentication credentials for OpenSearch
196* If both ApiKey/Bearer token and username+password is provided, tokens take precedence
197*/
198auth?:
199| {
200username: string;
201
202/**
203* @visibility secret
204*/
205password: string;
206}
207| {
208/**
209* @visibility secret
210*/
211apiKey: string;
212};
213}
214);
215};
216};
217}
218