mirror of
https://github.com/bitwarden/web
synced 2025-12-06 00:03:28 +00:00
Set baseUrl in QA cloud environment (#994)
* Set baseUrl if not deployed to prod server * Add env variable TARGET and use to set baseUrl * remove webPlatformUtilsService.isProdServer * passing the ENV through to the Angular app * switching the value of SELF_HOST back to true * fixing some webpack.config variables * fixing the selfhost angular process.env * removing unecessary code Co-authored-by: Joseph Flinn <joseph.s.flinn@gmail.com>
This commit is contained in:
@@ -144,9 +144,8 @@ containerService.attachToWindow(window);
|
|||||||
export function initFactory(): Function {
|
export function initFactory(): Function {
|
||||||
return async () => {
|
return async () => {
|
||||||
await (storageService as HtmlStorageService).init();
|
await (storageService as HtmlStorageService).init();
|
||||||
const isDev = platformUtilsService.isDev();
|
|
||||||
|
|
||||||
if (isDev || platformUtilsService.isSelfHost()) {
|
if (process.env.ENV !== 'production') {
|
||||||
environmentService.baseUrl = window.location.origin;
|
environmentService.baseUrl = window.location.origin;
|
||||||
} else {
|
} else {
|
||||||
environmentService.notificationsUrl = 'https://notifications.bitwarden.com';
|
environmentService.notificationsUrl = 'https://notifications.bitwarden.com';
|
||||||
|
|||||||
@@ -67,8 +67,8 @@ 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(this.platformUtilsService.isDev() ?
|
this.stripe = (window as any).Stripe(process.env.ENV === 'production' ?
|
||||||
WebConstants.stripeTestKey : WebConstants.stripeLiveKey);
|
WebConstants.stripeLiveKey : WebConstants.stripeTestKey);
|
||||||
this.stripeElements = this.stripe.elements();
|
this.stripeElements = this.stripe.elements();
|
||||||
this.setStripeElement();
|
this.setStripeElement();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,15 +8,13 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|||||||
const TerserPlugin = require('terser-webpack-plugin');
|
const TerserPlugin = require('terser-webpack-plugin');
|
||||||
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
|
const AngularCompilerPlugin = require('@ngtools/webpack').AngularCompilerPlugin;
|
||||||
const pjson = require('./package.json');
|
const pjson = require('./package.json');
|
||||||
const config = require('./config.js')
|
const config = require('./config.js');
|
||||||
|
|
||||||
if (process.env.NODE_ENV == null) {
|
const ENV = process.env.ENV == null ? 'development' : process.env.ENV;
|
||||||
process.env.NODE_ENV = 'development';
|
const NODE_ENV = process.env.NODE_ENV == null ? 'development' : process.env.NODE_ENV;
|
||||||
}
|
|
||||||
|
|
||||||
const NODE_ENV = process.env.NODE_ENV;
|
const envConfig = config.load(process.env.ENV);
|
||||||
const envConfig = config.load(process.env.ENV)
|
config.log(envConfig);
|
||||||
config.log(envConfig)
|
|
||||||
|
|
||||||
const moduleRules = [
|
const moduleRules = [
|
||||||
{
|
{
|
||||||
@@ -131,7 +129,7 @@ const plugins = [
|
|||||||
}),
|
}),
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
'process.env': {
|
'process.env': {
|
||||||
'ENV': JSON.stringify(NODE_ENV),
|
'ENV': JSON.stringify(ENV),
|
||||||
'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