UNPKG

2.15 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const findUp = require('find-up');
4const rc = require('rc');
5const { spawnSync } = require('child_process');
6const configs = {
7 dev: {
8 DeploymentUrl: 'https://developer.dev.bearer.sh/v1/',
9 IntegrationServiceHost: 'https://int.dev.bearer.sh/',
10 IntegrationServiceUrl: 'https://int.dev.bearer.sh/api/v1/',
11 DeveloperPortalAPIUrl: 'https://app.staging.bearer.sh/graphql',
12 DeveloperPortalUrl: 'https://app.staging.bearer.sh/',
13 CdnHost: 'https://static.dev.bearer.sh',
14 BearerEnv: 'dev'
15 },
16 staging: {
17 DeploymentUrl: 'https://developer.staging.bearer.sh/v1/',
18 IntegrationServiceHost: 'https://int.staging.bearer.sh/',
19 IntegrationServiceUrl: 'https://int.staging.bearer.sh/api/v1/',
20 DeveloperPortalAPIUrl: 'https://app.staging.bearer.sh/graphql',
21 DeveloperPortalUrl: 'https://app.staging.bearer.sh/',
22 CdnHost: 'https://static.staging.bearer.sh',
23 BearerEnv: 'staging'
24 },
25 production: {
26 DeploymentUrl: 'https://developer.bearer.sh/v1/',
27 IntegrationServiceHost: 'https://int.bearer.sh/',
28 IntegrationServiceUrl: 'https://int.bearer.sh/api/v1/',
29 DeveloperPortalAPIUrl: 'https://app.bearer.sh/graphql',
30 DeveloperPortalUrl: 'https://app.bearer.sh/',
31 CdnHost: 'https://static.bearer.sh',
32 BearerEnv: 'production'
33 }
34};
35exports.default = () => {
36 const { BEARER_ENV = 'production' } = process.env;
37 const setup = configs[BEARER_ENV];
38 const isYarnInstalled = !!spawnSync('yarn', ['bin']).output;
39 return Object.assign({}, setup, { isYarnInstalled, command: isYarnInstalled ? 'yarn' : 'npm', get bearerConfig() {
40 return rc('bearer');
41 },
42 get integrationConfig() {
43 return rc('integration');
44 },
45 get integrationTitle() {
46 return this.integrationConfig.integrationTitle;
47 },
48 get buid() {
49 return 'local';
50 },
51 get rootPathRc() {
52 return findUp.sync('.integrationrc');
53 } });
54};