Skip to content

Commit c90cd8a

Browse files
committed
support localhost env and custom urls
1 parent b7ab46c commit c90cd8a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/container.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ import type { WebviewViewProxy } from './webviews/webviewsController';
9898
import { WebviewsController } from './webviews/webviewsController';
9999
import { registerWelcomeWebviewPanel } from './webviews/welcome/registration';
100100

101-
export type Environment = 'dev' | 'staging' | 'production';
101+
export type Environment = 'local' | 'dev' | 'staging' | 'production';
102102

103103
export class Container {
104104
static #instance: Container | undefined;
@@ -527,6 +527,7 @@ export class Container {
527527
get env(): Environment {
528528
if (this.prereleaseOrDebugging) {
529529
const env = configuration.getAny('gitkraken.env');
530+
if (env === 'local') return 'local';
530531
if (env === 'dev') return 'dev';
531532
if (env === 'staging') return 'staging';
532533
}
@@ -927,6 +928,11 @@ export class Container {
927928
return Uri.parse('https://dev.gitkraken.dev');
928929
}
929930

931+
if (this.env === 'local') {
932+
const url: string | undefined = configuration.getAny('gitkraken.url.gkdev.base');
933+
return Uri.parse(url ?? 'http://localhost:3000');
934+
}
935+
930936
return Uri.parse('https://gitkraken.dev');
931937
}
932938

src/plus/gk/serverConnection.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { memoize } from '../../system/decorators/memoize';
2727
import { Logger } from '../../system/logger';
2828
import type { LogScope } from '../../system/logger.scope';
2929
import { getLogScope } from '../../system/logger.scope';
30+
import { configuration } from '../../system/vscode/configuration';
3031

3132
interface FetchOptions {
3233
cancellation?: CancellationToken;
@@ -55,6 +56,11 @@ export class ServerConnection implements Disposable {
5556
return Uri.parse('https://devapi.gitkraken.com');
5657
}
5758

59+
if (this.container.env === 'local') {
60+
const url: string | undefined = configuration.getAny('gitkraken.url.api');
61+
return Uri.parse(url ?? 'http://localhost:3000');
62+
}
63+
5864
return Uri.parse('https://api.gitkraken.com');
5965
}
6066

@@ -72,6 +78,11 @@ export class ServerConnection implements Disposable {
7278
return Uri.parse('https://dev-api.gitkraken.dev');
7379
}
7480

81+
if (this.container.env === 'local') {
82+
const url: string | undefined = configuration.getAny('gitkraken.url.gkdev.api');
83+
return Uri.parse(url ?? 'http://localhost:3000');
84+
}
85+
7586
return Uri.parse('https://api.gitkraken.dev');
7687
}
7788

0 commit comments

Comments
 (0)