Service environment (#23443)
* fix fileutils.TestFindFile on MacOS * introduce model.ExternalServiceEnvironment * pick license public key from external service env * pick Stripe public key from external service env * pick Rudder key from external service env * configure Sentry DSN from external service env * always log external_service_environment, Unsetenv * clear faked BuildEnv, improve logging * strip out unset GOTAGS * fix Sentry tests * simplify to just ServiceEnvironment * relocate ServiceEnvironment in client config * initialize CWS URLs based on service environment * unset rudder key for boards dev * harden service environment to avoid accidental production * fix TestSentry again * fix DEFAULT -> ENTERPRISE * s/dev/test when naming playbooks rudder key * simplify boards rudder key switch * use uniform rudderKey variable names * retain compatibility with existing pipeline * reduce to just production/test * unit test with valid test license * simplify Playbooks telemetry initialization * restore dev service environment * emit ServiceEnvironment when running e2e tests
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6c82605df0
Коммит
305fac6507
@@ -10,6 +10,9 @@ import {
|
||||
SetupIntent,
|
||||
} from '@stripe/stripe-js';
|
||||
|
||||
import {GlobalState} from 'types/store';
|
||||
import {ServiceEnvironment} from '@mattermost/types/config';
|
||||
|
||||
type ConfirmCardSetupType = (clientSecret: string, data?: ConfirmCardSetupData | undefined, options?: ConfirmCardSetupOptions | undefined) => Promise<{ setupIntent?: SetupIntent | undefined; error?: StripeError | undefined }> | undefined;
|
||||
|
||||
function prodConfirmCardSetup(confirmCardSetup: ConfirmCardSetupType): ConfirmCardSetupType {
|
||||
@@ -26,4 +29,15 @@ export const getConfirmCardSetup = (isCwsMockMode?: boolean) => (isCwsMockMode ?
|
||||
|
||||
export const STRIPE_CSS_SRC = 'https://fonts.googleapis.com/css?family=Open+Sans:400,400i,600,600i&display=swap';
|
||||
//eslint-disable-next-line no-process-env
|
||||
export const STRIPE_PUBLIC_KEY = process.env.STRIPE_PUBLIC_KEY || 'pk_test_ttEpW6dCHksKyfAFzh6MvgBj';
|
||||
|
||||
export const getStripePublicKey = (state: GlobalState) => {
|
||||
switch (state.entities.general.config.ServiceEnvironment) {
|
||||
case ServiceEnvironment.PRODUCTION:
|
||||
return 'pk_live_cDF5gYLPf5vQjJ7jp71p7GRK';
|
||||
case ServiceEnvironment.TEST:
|
||||
case ServiceEnvironment.DEV:
|
||||
return 'pk_test_ttEpW6dCHksKyfAFzh6MvgBj';
|
||||
}
|
||||
|
||||
return '';
|
||||
};
|
||||
|
||||
Ссылка в новой задаче
Block a user