Skip to content

Commit

Permalink
Adjusted envconfig service
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoric committed Jan 20, 2025
1 parent e9e04ae commit 9c4f7ad
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
8 changes: 4 additions & 4 deletions web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 18 additions & 9 deletions web/src/app/services/envconfig/envconfig.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,34 +48,43 @@ export class EnvConfigService {
}

loadEnvConfig(): Promise<void> {
if (environment.production) {
console.log('environment.production', environment.production);
return Promise.resolve();
}

return new Promise((resolve) => {
this.httpClient.get<EnvConfig>(ENV_CONFIG_JSON_URL).subscribe((data) => {
this.envConfig = data;
resolve();
this.httpClient.get<EnvConfig>(ENV_CONFIG_JSON_URL).subscribe({
next: (data) => {
this.envConfig = data;
resolve();
},
error: () => {
console.warn('Failed to load envconfig.json, using default values');
resolve();
},
});
});
}

getYuniKornWebAddress() {
console.log('environment.production', environment.production);
if (!environment.production) {
return `${this.envConfig.yunikornApiURL}/api`;
}

return `${this.uiProtocol}//${this.uiHostname}:${this.uiPort}/api`;
}

getUHSWebAddress() {
console.log('environment.production', environment.production);

if (!environment.production) {
return `${this.envConfig.uhsApiURL}/api`;
}

return `${this.uiProtocol}//${this.uiHostname}:${this.uiPort}/api`;
}

getExternalLogsBaseUrl() {
return this.envConfig.externalLogsURL || null;
if (!environment.production) {
return this.envConfig.externalLogsURL || null;
}
return null;
}
}

0 comments on commit 9c4f7ad

Please sign in to comment.