@appliance.sh/api-server 1.19.0 → 1.19.1
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.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appliance.sh/api-server",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Eliot Lim",
|
|
6
6
|
"repository": "https://github.com/appliance-sh/appliance.sh",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"test:e2e": "vitest run --config vitest.e2e.config.ts"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@appliance.sh/infra": "1.19.
|
|
23
|
-
"@appliance.sh/sdk": "1.19.
|
|
22
|
+
"@appliance.sh/infra": "1.19.1",
|
|
23
|
+
"@appliance.sh/sdk": "1.19.1",
|
|
24
24
|
"@aws-sdk/client-s3": "^3.750.0",
|
|
25
25
|
"express": "^5.2.1"
|
|
26
26
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
|
-
import { environmentInput
|
|
2
|
+
import { environmentInput } from '@appliance.sh/sdk';
|
|
3
3
|
import { environmentService } from '../../services/environment.service';
|
|
4
4
|
import { projectService } from '../../services/project.service';
|
|
5
5
|
|
|
@@ -8,12 +8,6 @@ interface EnvironmentParams {
|
|
|
8
8
|
id?: string;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
function getServerBaseConfig() {
|
|
12
|
-
const raw = process.env.APPLIANCE_BASE_CONFIG;
|
|
13
|
-
if (!raw) throw new Error('APPLIANCE_BASE_CONFIG is not set on the server');
|
|
14
|
-
return applianceBaseConfig.parse(JSON.parse(raw));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
11
|
export const environmentRoutes = Router({ mergeParams: true });
|
|
18
12
|
|
|
19
13
|
environmentRoutes.post('/', async (req, res) => {
|
|
@@ -24,12 +18,11 @@ environmentRoutes.post('/', async (req, res) => {
|
|
|
24
18
|
res.status(404).json({ error: 'Project not found' });
|
|
25
19
|
return;
|
|
26
20
|
}
|
|
27
|
-
const baseConfig = getServerBaseConfig();
|
|
28
21
|
const input = environmentInput.parse({
|
|
29
22
|
...req.body,
|
|
30
23
|
projectId: params.projectId,
|
|
31
24
|
});
|
|
32
|
-
const environment = await environmentService.create(input, project.name
|
|
25
|
+
const environment = await environmentService.create(input, project.name);
|
|
33
26
|
res.status(201).json(environment);
|
|
34
27
|
} catch (error) {
|
|
35
28
|
console.error('Create environment error:', error);
|
|
@@ -59,9 +59,7 @@ export class DeploymentService {
|
|
|
59
59
|
|
|
60
60
|
// Execute the deployment
|
|
61
61
|
try {
|
|
62
|
-
const deploymentService = createApplianceDeploymentService(
|
|
63
|
-
baseConfig: environment.baseConfig,
|
|
64
|
-
});
|
|
62
|
+
const deploymentService = createApplianceDeploymentService();
|
|
65
63
|
|
|
66
64
|
let result;
|
|
67
65
|
if (input.action === DeploymentAction.Deploy) {
|
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { Environment, EnvironmentInput, EnvironmentStatus, generateId } from '@appliance.sh/sdk';
|
|
2
|
-
import type { ApplianceBaseConfig } from '@appliance.sh/sdk';
|
|
3
2
|
import { getStorageService } from './storage.service';
|
|
4
3
|
|
|
5
4
|
const COLLECTION = 'environments';
|
|
6
5
|
|
|
7
6
|
export class EnvironmentService {
|
|
8
|
-
async create(input: EnvironmentInput, projectName: string
|
|
7
|
+
async create(input: EnvironmentInput, projectName: string): Promise<Environment> {
|
|
9
8
|
const storage = getStorageService();
|
|
10
9
|
const now = new Date().toISOString();
|
|
11
10
|
const id = generateId('env');
|
|
12
11
|
const environment: Environment = {
|
|
13
12
|
...input,
|
|
14
13
|
id,
|
|
15
|
-
baseConfig,
|
|
16
14
|
status: EnvironmentStatus.Pending,
|
|
17
15
|
stackName: `${projectName}-${input.name}`,
|
|
18
16
|
createdAt: now,
|