@captainsafia/burrow 1.0.0-preview.e3ae96a → 1.0.0-preview.e658904
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 +8 -2
- package/dist/api.d.ts +1 -1
- package/dist/api.js +46 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# burrow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Burrow is a platform-agnostic, directory-scoped secrets manager. Secrets are stored outside your repos in a local SQLite store and exportable to various formats via the CLI. For a nicer dev experience, Burrow currently stores secrets in a plain-text format outside the target repo, which means that secrets can still be leaked to other users on your machine or people who gain access to your device. But, for your day-to-day dev use, this beats keeping secrets in gitignored files in your repo.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
~/projects/ # DATABASE_URL, API_KEY defined here
|
|
@@ -44,8 +44,14 @@ burrow list --format json
|
|
|
44
44
|
### Export to your shell
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
+
# Auto-detects your shell (bash, fish, powershell, cmd)
|
|
47
48
|
eval "$(burrow export)"
|
|
48
|
-
|
|
49
|
+
|
|
50
|
+
# Or specify a format explicitly
|
|
51
|
+
burrow export --format fish
|
|
52
|
+
burrow export --format powershell
|
|
53
|
+
burrow export --format dotenv
|
|
54
|
+
burrow export --format json
|
|
49
55
|
```
|
|
50
56
|
|
|
51
57
|
### Block inheritance
|
package/dist/api.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface ResolvedSecret {
|
|
|
5
5
|
value: string;
|
|
6
6
|
sourcePath: string;
|
|
7
7
|
}
|
|
8
|
-
export type ExportFormat = "shell" | "dotenv" | "json";
|
|
8
|
+
export type ExportFormat = "shell" | "bash" | "fish" | "powershell" | "cmd" | "dotenv" | "json";
|
|
9
9
|
/**
|
|
10
10
|
* Configuration options for creating a BurrowClient instance.
|
|
11
11
|
*/
|
package/dist/api.js
CHANGED
|
@@ -251,6 +251,9 @@ function escapeShellValue(value) {
|
|
|
251
251
|
function escapeDoubleQuotes(value) {
|
|
252
252
|
return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
253
253
|
}
|
|
254
|
+
function escapePowerShellValue(value) {
|
|
255
|
+
return value.replace(/'/g, "''");
|
|
256
|
+
}
|
|
254
257
|
function formatShell(secrets) {
|
|
255
258
|
const lines = [];
|
|
256
259
|
const sortedKeys = Array.from(secrets.keys()).sort();
|
|
@@ -263,6 +266,42 @@ function formatShell(secrets) {
|
|
|
263
266
|
return lines.join(`
|
|
264
267
|
`);
|
|
265
268
|
}
|
|
269
|
+
function formatFish(secrets) {
|
|
270
|
+
const lines = [];
|
|
271
|
+
const sortedKeys = Array.from(secrets.keys()).sort();
|
|
272
|
+
for (const key of sortedKeys) {
|
|
273
|
+
const secret = secrets.get(key);
|
|
274
|
+
assertValidEnvKey(key);
|
|
275
|
+
const escapedValue = escapeShellValue(secret.value);
|
|
276
|
+
lines.push(`set -gx ${key} '${escapedValue}'`);
|
|
277
|
+
}
|
|
278
|
+
return lines.join(`
|
|
279
|
+
`);
|
|
280
|
+
}
|
|
281
|
+
function formatPowerShell(secrets) {
|
|
282
|
+
const lines = [];
|
|
283
|
+
const sortedKeys = Array.from(secrets.keys()).sort();
|
|
284
|
+
for (const key of sortedKeys) {
|
|
285
|
+
const secret = secrets.get(key);
|
|
286
|
+
assertValidEnvKey(key);
|
|
287
|
+
const escapedValue = escapePowerShellValue(secret.value);
|
|
288
|
+
lines.push(`$env:${key} = '${escapedValue}'`);
|
|
289
|
+
}
|
|
290
|
+
return lines.join(`
|
|
291
|
+
`);
|
|
292
|
+
}
|
|
293
|
+
function formatCmd(secrets) {
|
|
294
|
+
const lines = [];
|
|
295
|
+
const sortedKeys = Array.from(secrets.keys()).sort();
|
|
296
|
+
for (const key of sortedKeys) {
|
|
297
|
+
const secret = secrets.get(key);
|
|
298
|
+
assertValidEnvKey(key);
|
|
299
|
+
const escapedValue = secret.value.replace(/([&|<>^])/g, "^$1");
|
|
300
|
+
lines.push(`set ${key}=${escapedValue}`);
|
|
301
|
+
}
|
|
302
|
+
return lines.join(`
|
|
303
|
+
`);
|
|
304
|
+
}
|
|
266
305
|
function formatDotenv(secrets) {
|
|
267
306
|
const lines = [];
|
|
268
307
|
const sortedKeys = Array.from(secrets.keys()).sort();
|
|
@@ -300,7 +339,14 @@ function formatJson(secrets, includeSources = false) {
|
|
|
300
339
|
function format(secrets, fmt, options = {}) {
|
|
301
340
|
switch (fmt) {
|
|
302
341
|
case "shell":
|
|
342
|
+
case "bash":
|
|
303
343
|
return formatShell(secrets);
|
|
344
|
+
case "fish":
|
|
345
|
+
return formatFish(secrets);
|
|
346
|
+
case "powershell":
|
|
347
|
+
return formatPowerShell(secrets);
|
|
348
|
+
case "cmd":
|
|
349
|
+
return formatCmd(secrets);
|
|
304
350
|
case "dotenv":
|
|
305
351
|
return formatDotenv(secrets);
|
|
306
352
|
case "json":
|