@agilecustoms/envctl 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BusinessException, KnownException, NotFoundException } from '../exceptions.js';
|
|
2
2
|
import { EnvStatus } from '../model/index.js';
|
|
3
|
-
import { HttpClient } from './HttpClient.js';
|
|
3
|
+
import { HttpClient, toUrl } from './HttpClient.js';
|
|
4
4
|
export class EnvApiClient {
|
|
5
5
|
httpClient;
|
|
6
6
|
constructor(httpClient) {
|
|
@@ -28,7 +28,7 @@ export class EnvApiClient {
|
|
|
28
28
|
}
|
|
29
29
|
throw error;
|
|
30
30
|
}
|
|
31
|
-
return result.token;
|
|
31
|
+
return toUrl(`/public/env/${env.key}/extend?token=${result.token}`);
|
|
32
32
|
}
|
|
33
33
|
async create(env) {
|
|
34
34
|
let result;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { BusinessException, HttpException, NotFoundException } from '../exceptions.js';
|
|
2
2
|
const HOST = 'cli.maintenance.agilecustoms.com';
|
|
3
|
+
export function toUrl(path) {
|
|
4
|
+
return `https://${HOST}/env-api${path}`;
|
|
5
|
+
}
|
|
3
6
|
export class HttpClient {
|
|
4
7
|
constructor() { }
|
|
5
8
|
async post(path, body, options = {}) {
|
|
@@ -15,7 +18,7 @@ export class HttpClient {
|
|
|
15
18
|
return await this.fetch(path, options);
|
|
16
19
|
}
|
|
17
20
|
async fetch(path, options = {}) {
|
|
18
|
-
const url =
|
|
21
|
+
const url = toUrl(path);
|
|
19
22
|
let response;
|
|
20
23
|
try {
|
|
21
24
|
response = await fetch(url, options);
|