mirror of
https://github.com/bitwarden/browser
synced 2025-12-17 16:53:34 +00:00
Set urls from config file (#1151)
* Set environment URLs in webpack config. * Provide non NULL dev server * QA env uses the pq TLD * Include icons in qa env * Move base configs to develop. local configurations should be done in the `./config/local.json` file. * Fix config override loading to default to development * Standardize url formatting * Limit QA settings to those set in production * Set self hosted in a config * Specify cloud instead of production Self hosted and cloud are both production environments. The ENV setting is used to specify the env type while NODE_ENV specifies whether development error handling and services. * Update config instructions * Remove invalid json * Change env `production` references to `cloud` * Fix formatting
This commit is contained in:
@@ -62,7 +62,7 @@ import { CipherService as CipherServiceAbstraction } from 'jslib-common/abstract
|
||||
import { CollectionService as CollectionServiceAbstraction } from 'jslib-common/abstractions/collection.service';
|
||||
import { CryptoService as CryptoServiceAbstraction } from 'jslib-common/abstractions/crypto.service';
|
||||
import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from 'jslib-common/abstractions/cryptoFunction.service';
|
||||
import { EnvironmentService as EnvironmentServiceAbstraction } from 'jslib-common/abstractions/environment.service';
|
||||
import { EnvironmentService as EnvironmentServiceAbstraction, Urls } from 'jslib-common/abstractions/environment.service';
|
||||
import { EventService as EventLoggingServiceAbstraction } from 'jslib-common/abstractions/event.service';
|
||||
import { ExportService as ExportServiceAbstraction } from 'jslib-common/abstractions/export.service';
|
||||
import { FileUploadService as FileUploadServiceAbstraction } from 'jslib-common/abstractions/fileUpload.service';
|
||||
@@ -147,16 +147,9 @@ export function initFactory(): Function {
|
||||
return async () => {
|
||||
await (storageService as HtmlStorageService).init();
|
||||
|
||||
if (process.env.ENV !== 'production' || platformUtilsService.isSelfHost()) {
|
||||
environmentService.setUrls({ base: window.location.origin }, false);
|
||||
} else {
|
||||
environmentService.setUrls({
|
||||
base: window.location.origin,
|
||||
icons: 'https://icons.bitwarden.net',
|
||||
notifications: 'https://notifications.bitwarden.com',
|
||||
enterprise: 'https://portal.bitwarden.com',
|
||||
}, false);
|
||||
}
|
||||
const urls = process.env.URLS as Urls;
|
||||
urls.base ??= window.location.origin;
|
||||
environmentService.setUrls(urls, false);
|
||||
|
||||
setTimeout(() => notificationsService.init(), 3000);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ export class AddCreditComponent implements OnInit {
|
||||
|
||||
constructor(private userService: UserService, private apiService: ApiService,
|
||||
private platformUtilsService: PlatformUtilsService) {
|
||||
if (process.env.ENV !== 'production' || platformUtilsService.isDev()) {
|
||||
if (process.env.ENV !== 'cloud' || platformUtilsService.isDev()) {
|
||||
this.ppButtonFormAction = WebConstants.paypal.buttonActionSandbox;
|
||||
this.ppButtonBusinessId = WebConstants.paypal.businessIdSandbox;
|
||||
}
|
||||
|
||||
@@ -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' && !platformUtilsService.isDev() ?
|
||||
this.stripe = (window as any).Stripe(process.env.ENV === 'cloud' && !platformUtilsService.isDev() ?
|
||||
WebConstants.stripeLiveKey : WebConstants.stripeTestKey);
|
||||
this.stripeElements = this.stripe.elements();
|
||||
this.setStripeElement();
|
||||
@@ -126,7 +126,7 @@ export class PaymentComponent implements OnInit {
|
||||
if (this.method === PaymentMethodType.PayPal) {
|
||||
window.setTimeout(() => {
|
||||
(window as any).braintree.dropin.create({
|
||||
authorization: process.env.ENV === 'production' ?
|
||||
authorization: process.env.ENV === 'cloud' ?
|
||||
WebConstants.btProductionKey : WebConstants.btSandboxKey,
|
||||
container: '#bt-dropin-container',
|
||||
paymentOptionPriority: ['paypal'],
|
||||
|
||||
@@ -253,7 +253,7 @@ export class WebPlatformUtilsService implements PlatformUtilsService {
|
||||
}
|
||||
|
||||
isSelfHost(): boolean {
|
||||
return process.env.SELF_HOST.toString() === 'true';
|
||||
return process.env.ENV.toString() === 'selfhosted';
|
||||
}
|
||||
|
||||
copyToClipboard(text: string, options?: any): void | boolean {
|
||||
|
||||
Reference in New Issue
Block a user