backstage

Форк
0
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

17
export interface Config {
18
  /** Configuration options for the search plugin */
19
  search?: {
20
    /**
21
     * Options for ElasticSearch
22
     */
23
    elasticsearch?: {
24
      /**
25
       * Batch size for elastic search indexing tasks. Defaults to 1000.
26
       */
27
      batchSize?: number;
28
      /**
29
       * Options for configuring highlight settings
30
       * See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/highlighting.html
31
       */
32
      highlightOptions?: {
33
        /**
34
         * The size of the highlighted fragment in characters. Defaults to 1000.
35
         */
36
        fragmentSize?: number;
37
        /**
38
         * Number of result fragments to extract. Fragments will be concatenated with `fragmentDelimiter`. Defaults to 1.
39
         */
40
        numFragments?: number;
41
        /**
42
         * Delimiter string used to concatenate fragments. Defaults to " ... ".
43
         */
44
        fragmentDelimiter?: string;
45
      };
46

47
      /** Elasticsearch specific index template bodies */
48
      indexTemplates?: Array<{
49
        name: string;
50
        body: {
51
          /**
52
           * Array of wildcard (*) expressions used to match the names of data streams and indices during creation.
53
           */
54
          index_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
           */
61
          composed_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
           */
67
          template?: {
68
            [key: string]: unknown;
69
          };
70
        };
71
      }>;
72

73
      /** Miscellaneous options for the client */
74
      clientOptions?: {
75
        ssl?: {
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
           */
81
          rejectUnauthorized?: boolean;
82
        };
83
      } & (
84
        | {
85
            // elastic = Elastic.co ElasticSearch provider
86
            provider: '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
             */
92
            cloudId: string;
93

94
            auth: {
95
              username: string;
96

97
              /**
98
               * @visibility secret
99
               */
100
              password: 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
        | {
110
            provider: '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
             */
117
            node: string;
118

119
            /**
120
             * The AWS region.
121
             * Only needed if using a custom DNS record.
122
             */
123
            region?: 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
             */
130
            service?: '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
             */
145
            node: string | string[];
146

147
            /**
148
             * Authentication credentials for ElasticSearch
149
             * If both ApiKey/Bearer token and username+password is provided, tokens take precedence
150
             */
151
            auth?:
152
              | {
153
                  username: string;
154

155
                  /**
156
                   * @visibility secret
157
                   */
158
                  password: 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
                   */
167
                  apiKey: 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
       *
178
      bearer: string;
179
    };*/
180
          }
181

182
        /**
183
         *  AWS = In house hosting Open Search
184
         */
185
        | {
186
            provider: '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
             */
192
            node: string | string[];
193

194
            /**
195
             * Authentication credentials for OpenSearch
196
             * If both ApiKey/Bearer token and username+password is provided, tokens take precedence
197
             */
198
            auth?:
199
              | {
200
                  username: string;
201

202
                  /**
203
                   * @visibility secret
204
                   */
205
                  password: string;
206
                }
207
              | {
208
                  /**
209
                   * @visibility secret
210
                   */
211
                  apiKey: string;
212
                };
213
          }
214
      );
215
    };
216
  };
217
}
218

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.