UNPKG

growthbook

Version:

The GrowthBook command-line interface (CLI) for working with the GrowthBook A/B testing, feature flagging, and experimentation platform

36 lines (35 loc) 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = require("@oclif/core"); const cli_1 = require("../../utils/cli"); const constants_1 = require("../../utils/constants"); const config_1 = require("../../utils/config"); const sdk_connections_repository_1 = require("../../repositories/sdk-connections.repository"); class SdkconnectionsGet extends core_1.Command { async run() { const { args: { id, }, flags: { profile, apiBaseUrl, }, } = await this.parse(SdkconnectionsGet); const profileUsed = profile || constants_1.DEFAULT_GROWTHBOOK_PROFILE; const { apiKey, apiBaseUrl: configApiBaseUrl } = (0, config_1.getGrowthBookProfileConfigAndThrowForCommand)(profileUsed, this); const baseUrlUsed = apiBaseUrl || configApiBaseUrl || constants_1.DEFAULT_GROWTHBOOK_BASE_URL; const repo = new sdk_connections_repository_1.SdkConnectionsRepository({ apiKey, apiBaseUrl: baseUrlUsed, }); const connection = await repo.getSdkConnection(id); this.logJson(connection); } } exports.default = SdkconnectionsGet; SdkconnectionsGet.description = 'Client keys and settings for connecting SDKs to a GrowthBook instance'; SdkconnectionsGet.examples = [ '<%= config.bin %> <%= command.id %>', ]; SdkconnectionsGet.flags = { ...cli_1.baseGrowthBookCliFlags, }; SdkconnectionsGet.args = { id: core_1.Args.string({ description: 'SDK connection ID', required: true, }), };