Feature/clearml server root url #21

- missing files
This commit is contained in:
shyallegro 2022-05-11 10:45:21 +03:00 committed by Shay Halsband
parent 90c41957d8
commit ce9a7456a6
2 changed files with 16 additions and 5 deletions

7
src/env.js Normal file
View File

@ -0,0 +1,7 @@
(function (window) {
window.__env = window.__env || {};
// Sub_Path
window.__env.subPath = '${CLEARML_SERVER_SUB_PATH}';
}(this));

View File

@ -1,8 +1,8 @@
import {enableProdMode} from '@angular/core';
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic';
import {AppModule} from './app/app.module';
import {ConfigurationService} from './app/webapp-common/shared/services/configuration.service';
import {AppModule} from '~/app.module';
import {ConfigurationService} from '@common/shared/services/configuration.service';
import {updateHttpUrlBaseConstant} from '~/app.constants';
const environment = ConfigurationService.globalEnvironment;
if (environment.production) {
@ -10,7 +10,7 @@ if (environment.production) {
}
if (window.navigator && navigator.serviceWorker) {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
navigator.serviceWorker.getRegistrations().then(registrations => {
for (const registration of registrations) {
registration.unregister();
}
@ -31,4 +31,8 @@ if (savedData) {
}
}
platformBrowserDynamic().bootstrapModule(AppModule);
(async () => {
const baseHref = ( window as any ).__env.subPath || '' as string;
updateHttpUrlBaseConstant({...environment, ...(baseHref && !baseHref.startsWith('${') && {apiBaseUrl: baseHref + environment.apiBaseUrl})});
await platformBrowserDynamic().bootstrapModule(AppModule);
})();