Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
If internal links are not specified, the external one should be used (#…
Browse files Browse the repository at this point in the history
…1161)

* Don't set public url value to internal url settings. Fix hang loading che-theia when internal network disabled.

Signed-off-by: Oleksandr Andriienko <[email protected]>
  • Loading branch information
AndrienkoAleksandr authored Aug 3, 2021
1 parent e0d5c61 commit 1a8727f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ export class ChePluginServiceImpl implements ChePluginService {

try {
const workspaceSettings: WorkspaceSettings = await this.workspaceService.getWorkspaceSettings();
if (workspaceSettings && workspaceSettings[PLUGIN_REGISTRY_INTERNAL_URL]) {
const uri = workspaceSettings[PLUGIN_REGISTRY_INTERNAL_URL];
const publicUri = workspaceSettings[PLUGIN_REGISTRY_URL] || uri;
if (workspaceSettings) {
const publicUri = workspaceSettings[PLUGIN_REGISTRY_URL];
const uri = workspaceSettings[PLUGIN_REGISTRY_INTERNAL_URL] || publicUri;

this.defaultRegistry = {
name: 'Eclipse Che plugins',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class CheServerHttpServiceImpl implements HttpService {
const certificateAuthority = await this.certificateService.getCertificateAuthority();

const proxyUrl = process.env.http_proxy;
const baseUrl = process.env.CHE_API;
const baseUrl = process.env.CHE_API_EXTERNAL;
console.log('proxyUrl && proxyUrl !== && baseUrl', proxyUrl && proxyUrl !== '' && baseUrl);
if (proxyUrl && proxyUrl !== '' && baseUrl) {
const parsedBaseUrl = url.parse(baseUrl);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ export class CheServerRemoteApiImpl {
* baseAPIUrl - responsible for storing base url to API service, taken from environment variable
* machineToken - machine token taken from environment variable, always the same at workspace lifecycle
*/
private readonly baseAPIUrl: string;
private readonly baseAPIUrl: string | undefined;
private readonly machineToken: string;

constructor() {
if (process.env.CHE_API_INTERNAL === undefined) {
console.error('Unable to create Che API REST Client: "CHE_API_INTERNAL" is not set.');
} else {
this.baseAPIUrl = process.env.CHE_API_INTERNAL;
this.baseAPIUrl = process.env.CHE_API_INTERNAL || process.env.CHE_API_EXTERNAL;
if (!this.baseAPIUrl) {
console.error('Unable to create Che API REST client: "CHE_API" is not set');
}

if (process.env.CHE_MACHINE_TOKEN === undefined) {
Expand All @@ -52,6 +51,6 @@ export class CheServerRemoteApiImpl {
}

getCheApiURI(): string {
return this.baseAPIUrl;
return this.baseAPIUrl!;
}
}

0 comments on commit 1a8727f

Please sign in to comment.