mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-01 13:13:36 +01:00
Add proxies for notifications and portal. Simplify environment service (#919)
This commit is contained in:
parent
f81ad479dd
commit
58850821ba
@ -22,8 +22,6 @@ import { AuthGuardService } from 'jslib/angular/services/auth-guard.service';
|
|||||||
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
|
||||||
import { ValidationService } from 'jslib/angular/services/validation.service';
|
import { ValidationService } from 'jslib/angular/services/validation.service';
|
||||||
|
|
||||||
import { Analytics } from 'jslib/misc/analytics';
|
|
||||||
|
|
||||||
import { ApiService } from 'jslib/services/api.service';
|
import { ApiService } from 'jslib/services/api.service';
|
||||||
import { AppIdService } from 'jslib/services/appId.service';
|
import { AppIdService } from 'jslib/services/appId.service';
|
||||||
import { AuditService } from 'jslib/services/audit.service';
|
import { AuditService } from 'jslib/services/audit.service';
|
||||||
@ -139,23 +137,20 @@ const environmentService = new EnvironmentService(apiService, storageService, no
|
|||||||
const auditService = new AuditService(cryptoFunctionService, apiService);
|
const auditService = new AuditService(cryptoFunctionService, apiService);
|
||||||
const eventLoggingService = new EventLoggingService(storageService, apiService, userService, cipherService);
|
const eventLoggingService = new EventLoggingService(storageService, apiService, userService, cipherService);
|
||||||
|
|
||||||
const analytics = new Analytics(window, () => platformUtilsService.isDev() || platformUtilsService.isSelfHost(),
|
|
||||||
platformUtilsService, storageService, appIdService);
|
|
||||||
containerService.attachToWindow(window);
|
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();
|
const isDev = platformUtilsService.isDev();
|
||||||
if (!isDev && platformUtilsService.isSelfHost()) {
|
|
||||||
|
if (isDev || platformUtilsService.isSelfHost()) {
|
||||||
environmentService.baseUrl = window.location.origin;
|
environmentService.baseUrl = window.location.origin;
|
||||||
} else {
|
} else {
|
||||||
environmentService.webVaultUrl = isDev ? 'https://localhost:8080' : null;
|
environmentService.notificationsUrl = 'https://notifications.bitwarden.com';
|
||||||
environmentService.notificationsUrl = isDev ? 'http://localhost:61840' :
|
environmentService.enterpriseUrl = 'https://portal.bitwarden.com';
|
||||||
'https://notifications.bitwarden.com'; // window.location.origin + '/notifications';
|
|
||||||
environmentService.enterpriseUrl = isDev ? 'http://localhost:52313' :
|
|
||||||
'https://portal.bitwarden.com'; // window.location.origin + '/portal';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apiService.setUrls({
|
apiService.setUrls({
|
||||||
base: window.location.origin,
|
base: window.location.origin,
|
||||||
api: null,
|
api: null,
|
||||||
|
@ -160,41 +160,47 @@ const devServer = {
|
|||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://localhost:4000',
|
target: 'http://localhost:4000',
|
||||||
pathRewrite: {'^/api' : ''}
|
|
||||||
},
|
|
||||||
'/identity': {
|
|
||||||
target: 'http://localhost:33656',
|
|
||||||
pathRewrite: {'^/identity' : ''}
|
|
||||||
},
|
|
||||||
'/events': {
|
|
||||||
target: 'http://localhost:46273',
|
|
||||||
pathRewrite: {'^/events' : ''}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hot: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (ENV === "production") {
|
|
||||||
devServer.proxy = {
|
|
||||||
'/api': {
|
|
||||||
target: 'https://api.bitwarden.com',
|
|
||||||
pathRewrite: {'^/api' : ''},
|
pathRewrite: {'^/api' : ''},
|
||||||
secure: false,
|
secure: false,
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
},
|
},
|
||||||
'/identity': {
|
'/identity': {
|
||||||
target: 'https://identity.bitwarden.com',
|
target: 'http://localhost:33656',
|
||||||
pathRewrite: {'^/identity' : ''},
|
pathRewrite: {'^/identity' : ''},
|
||||||
secure: false,
|
secure: false,
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
},
|
},
|
||||||
'/events': {
|
'/events': {
|
||||||
target: 'https://events.bitwarden.com',
|
target: 'http://localhost:46273',
|
||||||
pathRewrite: {'^/events' : ''},
|
pathRewrite: {'^/events' : ''},
|
||||||
secure: false,
|
secure: false,
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
|
},
|
||||||
|
'/notifications': {
|
||||||
|
target: 'http://localhost:61840',
|
||||||
|
pathRewrite: {'^/notifications' : ''},
|
||||||
|
secure: false,
|
||||||
|
changeOrigin: true
|
||||||
|
},
|
||||||
|
'/portal': {
|
||||||
|
target: 'http://localhost:52313',
|
||||||
|
pathRewrite: {'^/portal' : ''},
|
||||||
|
secure: false,
|
||||||
|
changeOrigin: true
|
||||||
}
|
}
|
||||||
};
|
},
|
||||||
|
hot: false,
|
||||||
|
allowedHosts: [
|
||||||
|
'bitwarden.test',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ENV === "production") {
|
||||||
|
devServer.proxy['/api'].target = 'https://api.bitwarden.com';
|
||||||
|
devServer.proxy['/identity'].target = 'https://identity.bitwarden.com';
|
||||||
|
devServer.proxy['/events'].target = 'https://events.bitwarden.com';
|
||||||
|
devServer.proxy['/notifications'].target = 'https://notifications.bitwarden.com';
|
||||||
|
devServer.proxy['/portal'].target = 'https://portal.bitwarden.com';
|
||||||
}
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
|
Loading…
Reference in New Issue
Block a user