Repository URL to install this package:
|
Version:
0.0.0-eb7f46753a3bdc ▾
|
const path = require('path');
const homedir = require('os').homedir();
const DOODLE_HOME_DIR_PATH = path.join(homedir, '.doodlecli');
const CONFIGURATION_FILE = path.join(DOODLE_HOME_DIR_PATH, 'config.json');
const DOODLE_REPOS_JSON_FILE = path.join('src', 'data', 'repos.json');
// Config keys
const CONFIG_EMAIL_KEY = 'EMAIL';
const CONFIG_FIRST_NAME_KEY = 'FIRST_NAME';
const CONFIG_PASSWORD_KEY = 'PASSWORD';
const CONFIG_GITHUB_TOKEN_KEY = 'GITHUB_TOKEN';
const CONFIG_DEBUG_MODE_KEY = 'DEBUG_MODE';
const verboseLogging = [true, 'true'].includes(process.env.VERBOSE);
const MODULE_ROOT_DIR = path.dirname(require.main.filename);
const MEETING_TYPES = {
'One to One (SchedEx)': 'ONE_TO_ONE',
'Booking Page (SchedEx)': 'BOOKING_PAGE',
'Groups (Schedex)': 'GROUPS',
};
const MEETING_LOCATIONS = {
Geo: 'GEO',
Text: 'TEXT',
};
const VIDEO_CONFERENCING_TOOLS = {
'Google Meet': 'GOOGLE_MEET',
'Microsoft Teams': 'MS_TEAMS',
Zoom: 'ZOOM',
};
/**
* Projects that are TagFlow-enabled. Please update this list with a PR. ;)
*/
const TAGFLOW_PROJECTS = [
'web-settings',
'web-static-site',
'web-unified-dashboard',
'web-admin',
'web-scheduling-experience',
'web-groups',
'web-billing',
'svc-scheduling-experience',
'svc-meeting',
'svc-zoom-integration',
'svc-video-conferencing',
].sort();
// HTTP response codes
const STATUS_OK = 200;
const STATUS_CREATED = 201;
/**
* Doodle environments.
*
* Important that the key here needs to match the environment name as labeled by a kubernetes namespace
* (if this namespace is one that TagFlow can deploy to, e.g., `dtn.env-name-here`).
*/
const DOODLE_ENVS = {
local: {
baseUrl: 'https://dev.doodle-test.com',
},
staging: {
baseUrl: 'https://staging.doodle-test.com',
serviceBillingBase: 'https://ambassador-stg.doodle-test.com/billing/v1',
monolithApiBase: 'https://staging.doodle-test.com/api',
keycloakAuthUrl: 'https://staging.doodle-test.com/auth',
keycloakInternalAuthUrl: 'https://iam-staging.internal.doodle-test.com/auth',
schedexApiBase: 'https://ambassador-stg.doodle-test.com/scheduling',
vaultAddress: 'https://vault.internal.doodle-test.com',
},
preproduction: {
baseUrl: 'https://doodle-test.com',
serviceBillingBase: 'https://ambassador.doodle-test.com/billing/v1',
monolithApiBase: 'https://ambassador.doodle-test.com',
keycloakAuthUrl: 'https://doodle-test.com/auth',
keycloakInternalAuthUrl: 'https://iam.internal.doodle-test.com/auth',
schedexApiBase: 'https://ambassador.doodle-test.com/scheduling',
vaultAddress: 'https://vault.internal.doodle-test.com',
},
};
// Keep track of which devboxes are the legacy devboxes. This is required
// because some endpoints might be different for the legacy devboxes.
const legacyDevboxes = ['devbox-schedex-1', 'devbox-schedex-2'];
// Generate the values for devboxes since the patterns are predictable.
// To add support for a new devbox, simply update this array with a PR.
// TODO: Make this list auto-update with a cached result of `$ kubectl get ns`
// once there are no more legacy devboxes
[
...legacyDevboxes,
'devbox-admin-1',
'devbox-core-1',
'devbox-core-2',
'devbox-core-3',
'devbox-iivic-1',
'devbox-integ-1',
'devbox-istest-1',
'devbox-loadtests-1',
'devbox-meetme-1',
'devbox-monet-1',
'devbox-raffis-1',
'devbox-schedex-3',
'devbox-schedex-api-1',
]
.sort()
.forEach(namespace => {
const baseUrl = `https://${namespace}.kubernetes.doodle-test.com`;
DOODLE_ENVS[namespace] = {
baseUrl,
serviceBillingBase: `https://ambassador-${namespace}.kubernetes.doodle-test.com/billing/v1`,
schedexApiBase: `https://ambassador-${namespace}.kubernetes.doodle-test.com/scheduling`,
monolithApiBase: `https://${namespace}.kubernetes.doodle-test.com/api`,
keycloakAuthUrl: `${baseUrl}/auth`,
keycloakInternalAuthUrl: `https://iam-${namespace}.internal.doodle-test.com/auth`,
vaultAddress: `https://vault-${namespace}.internal.doodle-test.com`,
};
if (legacyDevboxes.includes(namespace)) {
// the svc-billing endpoint is different for legacy devboxes
DOODLE_ENVS[namespace].serviceBillingBase = `https://ambassador-${namespace}.doodle-test.com/billing/v1`;
// legacy devboxes use the staging vault address
DOODLE_ENVS[namespace].vaultAddress = 'https://vault.internal.doodle-test.com';
}
});
/**
* All of the deployable namespaces.
*/
const NAMESPACES = Object.keys(DOODLE_ENVS).filter(env => env !== 'local');
// Error codes made human readable <3
const ENTITY_NOT_FOUND = 'ENOENT';
module.exports = {
DOODLE_ENVS,
CONFIGURATION_FILE,
TAGFLOW_PROJECTS,
NAMESPACES,
STATUS_OK,
STATUS_CREATED,
ENTITY_NOT_FOUND,
CONFIG_EMAIL_KEY,
CONFIG_FIRST_NAME_KEY,
CONFIG_PASSWORD_KEY,
CONFIG_GITHUB_TOKEN_KEY,
CONFIG_DEBUG_MODE_KEY,
DOODLE_HOME_DIR_PATH,
DOODLE_REPOS_JSON_FILE,
MEETING_TYPES,
MEETING_LOCATIONS,
VIDEO_CONFERENCING_TOOLS,
verboseLogging,
legacyDevboxes,
MODULE_ROOT_DIR,
};