@replayio/app-building 1.14.0 → 1.15.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/dist/secrets.d.ts +0 -6
- package/dist/secrets.js +0 -33
- package/package.json +1 -1
package/dist/secrets.d.ts
CHANGED
|
@@ -21,12 +21,6 @@ export declare function fetchGlobalSecrets(config: InfisicalConfig): Promise<Rec
|
|
|
21
21
|
* Fetch per-branch deployment secrets from `/branches/<branch>/`.
|
|
22
22
|
*/
|
|
23
23
|
export declare function fetchBranchSecrets(config: InfisicalConfig, branch: string): Promise<Record<string, string>>;
|
|
24
|
-
/**
|
|
25
|
-
* Resolve the full set of secrets to inject into a container:
|
|
26
|
-
* global build secrets + Infisical config vars (so the container can fetch branch secrets).
|
|
27
|
-
* Throws if any required secret from .env.example is missing.
|
|
28
|
-
*/
|
|
29
|
-
export declare function resolveContainerSecrets(config: InfisicalConfig): Promise<Record<string, string>>;
|
|
30
24
|
/**
|
|
31
25
|
* Extract Infisical config from environment variables and log in.
|
|
32
26
|
* Reads INFISICAL_CLIENT_ID, INFISICAL_CLIENT_SECRET, INFISICAL_PROJECT_ID,
|
package/dist/secrets.js
CHANGED
|
@@ -1,17 +1,4 @@
|
|
|
1
|
-
import { readFileSync } from "fs";
|
|
2
|
-
import { resolve, dirname } from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
1
|
const INFISICAL_API_BASE = "https://app.infisical.com";
|
|
6
|
-
/** Keys listed in src/package/.env.example that must be present in container secrets. */
|
|
7
|
-
function getRequiredSecretKeys() {
|
|
8
|
-
const examplePath = resolve(__dirname, ".env.example");
|
|
9
|
-
return readFileSync(examplePath, "utf-8")
|
|
10
|
-
.split("\n")
|
|
11
|
-
.map((l) => l.split("#")[0].trim())
|
|
12
|
-
.filter((l) => l && l.includes("="))
|
|
13
|
-
.map((l) => l.split("=")[0].trim());
|
|
14
|
-
}
|
|
15
2
|
/**
|
|
16
3
|
* Log in to Infisical using Universal Auth (Client ID + Client Secret).
|
|
17
4
|
* Returns a short-lived access token (default 30 day TTL).
|
|
@@ -72,26 +59,6 @@ export async function fetchGlobalSecrets(config) {
|
|
|
72
59
|
export async function fetchBranchSecrets(config, branch) {
|
|
73
60
|
return fetchInfisicalSecrets(config, `/branches/${branch}/`);
|
|
74
61
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Resolve the full set of secrets to inject into a container:
|
|
77
|
-
* global build secrets + Infisical config vars (so the container can fetch branch secrets).
|
|
78
|
-
* Throws if any required secret from .env.example is missing.
|
|
79
|
-
*/
|
|
80
|
-
export async function resolveContainerSecrets(config) {
|
|
81
|
-
const globals = await fetchGlobalSecrets(config);
|
|
82
|
-
const secrets = {
|
|
83
|
-
...globals,
|
|
84
|
-
INFISICAL_TOKEN: config.token,
|
|
85
|
-
INFISICAL_PROJECT_ID: config.projectId,
|
|
86
|
-
INFISICAL_ENVIRONMENT: config.environment,
|
|
87
|
-
};
|
|
88
|
-
const required = getRequiredSecretKeys();
|
|
89
|
-
const missing = required.filter((k) => !secrets[k]);
|
|
90
|
-
if (missing.length > 0) {
|
|
91
|
-
throw new Error(`Missing required secrets in Infisical /global/: ${missing.join(", ")}`);
|
|
92
|
-
}
|
|
93
|
-
return secrets;
|
|
94
|
-
}
|
|
95
62
|
/**
|
|
96
63
|
* Extract Infisical config from environment variables and log in.
|
|
97
64
|
* Reads INFISICAL_CLIENT_ID, INFISICAL_CLIENT_SECRET, INFISICAL_PROJECT_ID,
|