mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 14:53:33 +00:00
Ensure Angular is running as production (#1093)
This commit is contained in:
@@ -10,7 +10,7 @@ require('src/scss/styles.scss');
|
|||||||
|
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
if (process.env.ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
enableProdMode();
|
enableProdMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ require('../scss/styles.scss');
|
|||||||
|
|
||||||
import { AppModule } from './app.module';
|
import { AppModule } from './app.module';
|
||||||
|
|
||||||
if (process.env.ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
enableProdMode();
|
enableProdMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ if (!Element.prototype.matches && (Element.prototype as any).msMatchesSelector)
|
|||||||
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
|
// Production
|
||||||
} else {
|
} else {
|
||||||
// Development and test
|
// Development and test
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ export class AddCreditComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(private userService: UserService, private apiService: ApiService,
|
constructor(private userService: UserService, private apiService: ApiService,
|
||||||
private platformUtilsService: PlatformUtilsService) {
|
private platformUtilsService: PlatformUtilsService) {
|
||||||
if (platformUtilsService.isDev()) {
|
if (process.env.ENV !== 'production' || platformUtilsService.isDev()) {
|
||||||
this.ppButtonFormAction = WebConstants.paypal.buttonActionSandbox;
|
this.ppButtonFormAction = WebConstants.paypal.buttonActionSandbox;
|
||||||
this.ppButtonBusinessId = WebConstants.paypal.businessIdSandbox;
|
this.ppButtonBusinessId = WebConstants.paypal.businessIdSandbox;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export class PaymentComponent implements OnInit {
|
|||||||
this.stripeScript.src = 'https://js.stripe.com/v3/';
|
this.stripeScript.src = 'https://js.stripe.com/v3/';
|
||||||
this.stripeScript.async = true;
|
this.stripeScript.async = true;
|
||||||
this.stripeScript.onload = () => {
|
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);
|
WebConstants.stripeLiveKey : WebConstants.stripeTestKey);
|
||||||
this.stripeElements = this.stripe.elements();
|
this.stripeElements = this.stripe.elements();
|
||||||
this.setStripeElement();
|
this.setStripeElement();
|
||||||
@@ -126,8 +126,8 @@ export class PaymentComponent implements OnInit {
|
|||||||
if (this.method === PaymentMethodType.PayPal) {
|
if (this.method === PaymentMethodType.PayPal) {
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
(window as any).braintree.dropin.create({
|
(window as any).braintree.dropin.create({
|
||||||
authorization: this.platformUtilsService.isDev() ?
|
authorization: process.env.ENV === 'production' ?
|
||||||
WebConstants.btSandboxKey : WebConstants.btProductionKey,
|
WebConstants.btProductionKey : WebConstants.btSandboxKey,
|
||||||
container: '#bt-dropin-container',
|
container: '#bt-dropin-container',
|
||||||
paymentOptionPriority: ['paypal'],
|
paymentOptionPriority: ['paypal'],
|
||||||
paypal: {
|
paypal: {
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isDev(): boolean {
|
isDev(): boolean {
|
||||||
return process.env.ENV === 'development';
|
return process.env.NODE_ENV === 'development';
|
||||||
}
|
}
|
||||||
|
|
||||||
isSelfHost(): boolean {
|
isSelfHost(): boolean {
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ const plugins = [
|
|||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
'ENV': JSON.stringify(ENV),
|
'ENV': JSON.stringify(ENV),
|
||||||
|
'NODE_ENV': NODE_ENV === 'production' ? 'production' : 'development',
|
||||||
'SELF_HOST': JSON.stringify(process.env.SELF_HOST === 'true' ? true : false),
|
'SELF_HOST': JSON.stringify(process.env.SELF_HOST === 'true' ? true : false),
|
||||||
'APPLICATION_VERSION': JSON.stringify(pjson.version),
|
'APPLICATION_VERSION': JSON.stringify(pjson.version),
|
||||||
'CACHE_TAG': JSON.stringify(Math.random().toString(36).substring(7)),
|
'CACHE_TAG': JSON.stringify(Math.random().toString(36).substring(7)),
|
||||||
|
|||||||
Reference in New Issue
Block a user