1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

Ensure Angular is running as production (#1093)

This commit is contained in:
Oscar Hinton 2021-07-23 20:03:14 +02:00 committed by GitHub
parent d31150c7a1
commit 35d6a28c94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 8 deletions

View File

@ -10,7 +10,7 @@ require('src/scss/styles.scss');
import { AppModule } from './app.module';
if (process.env.ENV === 'production') {
if (process.env.NODE_ENV === 'production') {
enableProdMode();
}

View File

@ -10,7 +10,7 @@ require('../scss/styles.scss');
import { AppModule } from './app.module';
if (process.env.ENV === 'production') {
if (process.env.NODE_ENV === 'production') {
enableProdMode();
}

View File

@ -7,7 +7,7 @@ if (!Element.prototype.matches && (Element.prototype as any).msMatchesSelector)
Element.prototype.matches = (Element.prototype as any).msMatchesSelector;
}
if (process.env.ENV === 'production') {
if (process.env.NODE_ENV === 'production') {
// Production
} else {
// Development and test

View File

@ -47,7 +47,7 @@ export class AddCreditComponent implements OnInit {
constructor(private userService: UserService, private apiService: ApiService,
private platformUtilsService: PlatformUtilsService) {
if (platformUtilsService.isDev()) {
if (process.env.ENV !== 'production' || platformUtilsService.isDev()) {
this.ppButtonFormAction = WebConstants.paypal.buttonActionSandbox;
this.ppButtonBusinessId = WebConstants.paypal.businessIdSandbox;
}

View File

@ -67,7 +67,7 @@ export class PaymentComponent implements OnInit {
this.stripeScript.src = 'https://js.stripe.com/v3/';
this.stripeScript.async = true;
this.stripeScript.onload = () => {
this.stripe = (window as any).Stripe(process.env.ENV === 'production' ?
this.stripe = (window as any).Stripe(process.env.ENV === 'production' && !platformUtilsService.isDev() ?
WebConstants.stripeLiveKey : WebConstants.stripeTestKey);
this.stripeElements = this.stripe.elements();
this.setStripeElement();
@ -126,8 +126,8 @@ export class PaymentComponent implements OnInit {
if (this.method === PaymentMethodType.PayPal) {
window.setTimeout(() => {
(window as any).braintree.dropin.create({
authorization: this.platformUtilsService.isDev() ?
WebConstants.btSandboxKey : WebConstants.btProductionKey,
authorization: process.env.ENV === 'production' ?
WebConstants.btProductionKey : WebConstants.btSandboxKey,
container: '#bt-dropin-container',
paymentOptionPriority: ['paypal'],
paypal: {

View File

@ -249,7 +249,7 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
}
isDev(): boolean {
return process.env.ENV === 'development';
return process.env.NODE_ENV === 'development';
}
isSelfHost(): boolean {

View File

@ -135,6 +135,7 @@ const plugins = [
new webpack.DefinePlugin({
'process.env': {
'ENV': JSON.stringify(ENV),
'NODE_ENV': NODE_ENV === 'production' ? 'production' : 'development',
'SELF_HOST': JSON.stringify(process.env.SELF_HOST === 'true' ? true : false),
'APPLICATION_VERSION': JSON.stringify(pjson.version),
'CACHE_TAG': JSON.stringify(Math.random().toString(36).substring(7)),