Path: blob/main/components/gitpod-protocol/src/experiments/always-default.ts
2500 views
/**1* Copyright (c) 2022 Gitpod GmbH. All rights reserved.2* Licensed under the GNU Affero General Public License (AGPL).3* See License.AGPL.txt in the project root for license information.4*/5import { Attributes, Client } from "./types";67// AlwaysReturningDefaultValueClient is an implemention of an experiments.Client which performs no lookup/network operation8// and always returns the default value for a given experimentName.9// This client is used for non-SaaS version of Gitpod, in particular for self-hosted installations where external10// network connections are not desirable or even possible.11class AlwaysReturningDefaultValueClient implements Client {12getValueAsync<T>(experimentName: string, defaultValue: T, attributes: Attributes): Promise<T> {13return Promise.resolve(defaultValue);14}1516dispose(): void {17// there is nothing to dispose, no-op.18}19}2021export function newAlwaysReturningDefaultValueClient(): Client {22return new AlwaysReturningDefaultValueClient();23}242526