@replayio/app-building 1.12.0 → 1.13.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.
- package/README.md +18 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ npm install @replayio/app-building
|
|
|
14
14
|
import {
|
|
15
15
|
loadDotEnv,
|
|
16
16
|
FileContainerRegistry,
|
|
17
|
+
getInfisicalConfig,
|
|
18
|
+
resolveContainerSecrets,
|
|
17
19
|
createMachine,
|
|
18
20
|
destroyMachine,
|
|
19
21
|
type ContainerConfig,
|
|
@@ -23,14 +25,17 @@ import {
|
|
|
23
25
|
httpOptsFor,
|
|
24
26
|
} from "@replayio/app-building";
|
|
25
27
|
|
|
26
|
-
//
|
|
27
|
-
const
|
|
28
|
+
// Load orchestration vars from .env, then fetch build secrets from Infisical
|
|
29
|
+
const orchestrationVars = loadDotEnv("/path/to/project");
|
|
30
|
+
const infisicalConfig = getInfisicalConfig(orchestrationVars);
|
|
31
|
+
const containerSecrets = await resolveContainerSecrets(infisicalConfig);
|
|
32
|
+
|
|
28
33
|
const config: ContainerConfig = {
|
|
29
34
|
projectRoot: "/path/to/project", // optional — only needed for local Docker operations
|
|
30
|
-
envVars,
|
|
35
|
+
envVars: containerSecrets,
|
|
31
36
|
registry: new FileContainerRegistry("/path/to/.container-registry.jsonl"),
|
|
32
|
-
flyToken:
|
|
33
|
-
flyApp:
|
|
37
|
+
flyToken: orchestrationVars.FLY_API_TOKEN,
|
|
38
|
+
flyApp: orchestrationVars.FLY_APP_NAME,
|
|
34
39
|
};
|
|
35
40
|
|
|
36
41
|
// Create a Fly machine (automatically provisions a volume)
|
|
@@ -54,7 +59,7 @@ await destroyMachine(config.flyApp, config.flyToken, machineId, volumeId);
|
|
|
54
59
|
|
|
55
60
|
| Export | Description |
|
|
56
61
|
|---|---|
|
|
57
|
-
| `ContainerConfig` | Interface bundling all external state: optional `projectRoot` (only needed for local Docker operations), `envVars
|
|
62
|
+
| `ContainerConfig` | Interface bundling all external state: optional `projectRoot` (only needed for local Docker operations), `envVars` (build secrets from Infisical), `registry`, optional `flyToken`/`flyApp`/`imageRef`/`webhookUrl`/`webhookSecret`/`detached`/`initialPrompt`/`localPort`. See [Webhooks](#webhooks) and [Container lifecycle](#container-lifecycle) below. |
|
|
58
63
|
| `RepoOptions` | Per-invocation git settings: `repoUrl`, `cloneBranch`, `pushBranch`. |
|
|
59
64
|
| `ContainerRegistry` | Interface for container registry storage. Methods: `log`, `markStopped`, `clearStopped`, `getRecent`, `find`, `findAlive`. |
|
|
60
65
|
| `FileContainerRegistry` | Built-in file-backed implementation of `ContainerRegistry`, backed by a `.jsonl` file. |
|
|
@@ -183,7 +188,7 @@ so that interactive users can send follow-up messages at any time.
|
|
|
183
188
|
|
|
184
189
|
## Webhooks
|
|
185
190
|
|
|
186
|
-
Set `webhookUrl` on `ContainerConfig` to receive real-time notifications of container activity. The container POSTs JSON to that URL on key events (no retries; failures are logged to stderr).
|
|
191
|
+
Set `webhookUrl` on `ContainerConfig` to receive real-time notifications of container activity. The container POSTs JSON to that URL on key events (no retries; failures are logged to stderr). Set `webhookSecret` to include a `Bearer` token in the `Authorization` header for authenticating webhook requests.
|
|
187
192
|
|
|
188
193
|
### Payload format
|
|
189
194
|
|
|
@@ -224,10 +229,15 @@ Every POST body has this shape:
|
|
|
224
229
|
### Example
|
|
225
230
|
|
|
226
231
|
```ts
|
|
232
|
+
const orchestrationVars = loadDotEnv("/path/to/project");
|
|
233
|
+
const infisicalConfig = getInfisicalConfig(orchestrationVars);
|
|
234
|
+
const containerSecrets = await resolveContainerSecrets(infisicalConfig);
|
|
235
|
+
|
|
227
236
|
const config: ContainerConfig = {
|
|
228
237
|
projectRoot: "/path/to/project",
|
|
229
|
-
envVars:
|
|
238
|
+
envVars: containerSecrets,
|
|
230
239
|
registry: new FileContainerRegistry("/path/to/.container-registry.jsonl"),
|
|
231
240
|
webhookUrl: "https://example.com/hooks/container-events",
|
|
241
|
+
webhookSecret: "your-webhook-secret",
|
|
232
242
|
};
|
|
233
243
|
```
|