@captainsafia/burrow 1.0.0-preview.0d335f8 → 1.0.0-preview.aac83a8
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 +19 -6
- package/dist/api.d.ts +4 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ burrow set DATABASE_URL=postgres://localhost/mydb --path ~/projects
|
|
|
30
30
|
### Get a secret
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
|
-
burrow get API_KEY
|
|
33
|
+
burrow get API_KEY
|
|
34
34
|
burrow get API_KEY --format json
|
|
35
35
|
```
|
|
36
36
|
|
|
@@ -84,13 +84,26 @@ import { BurrowClient } from '@captainsafia/burrow';
|
|
|
84
84
|
|
|
85
85
|
const client = new BurrowClient();
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
try {
|
|
88
|
+
await client.set('API_KEY', 'secret123', { path: '/my/project' });
|
|
88
89
|
|
|
89
|
-
const secret = await client.get('API_KEY', { cwd: '/my/project/subdir' });
|
|
90
|
-
console.log(secret?.value); // 'secret123'
|
|
91
|
-
console.log(secret?.sourcePath); // '/my/project'
|
|
90
|
+
const secret = await client.get('API_KEY', { cwd: '/my/project/subdir' });
|
|
91
|
+
console.log(secret?.value); // 'secret123'
|
|
92
|
+
console.log(secret?.sourcePath); // '/my/project'
|
|
92
93
|
|
|
93
|
-
const allSecrets = await client.list({ cwd: '/my/project' });
|
|
94
|
+
const allSecrets = await client.list({ cwd: '/my/project' });
|
|
95
|
+
} finally {
|
|
96
|
+
client.close(); // Clean up database connection
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Or with TypeScript's `using` declarations for automatic cleanup:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
{
|
|
104
|
+
using client = new BurrowClient();
|
|
105
|
+
await client.set('API_KEY', 'secret123');
|
|
106
|
+
} // Automatically cleaned up
|
|
94
107
|
```
|
|
95
108
|
|
|
96
109
|
## Contributing
|
package/dist/api.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export interface BurrowClientOptions {
|
|
|
21
21
|
configDir?: string;
|
|
22
22
|
/**
|
|
23
23
|
* Custom filename for the secrets store.
|
|
24
|
-
* Defaults to `store.
|
|
24
|
+
* Defaults to `store.db`.
|
|
25
25
|
*/
|
|
26
26
|
storeFileName?: string;
|
|
27
27
|
/**
|
|
@@ -99,10 +99,6 @@ export interface ExportOptions {
|
|
|
99
99
|
* - `json`: Exports as a JSON object
|
|
100
100
|
*/
|
|
101
101
|
format?: ExportFormat;
|
|
102
|
-
/**
|
|
103
|
-
* Whether to show actual values (currently unused, reserved for future use).
|
|
104
|
-
*/
|
|
105
|
-
showValues?: boolean;
|
|
106
102
|
/**
|
|
107
103
|
* Whether to include source paths in JSON output.
|
|
108
104
|
* When true, JSON output includes `{ key: { value, sourcePath } }` format.
|
|
@@ -151,7 +147,7 @@ export declare class BurrowClient {
|
|
|
151
147
|
* The secret will be available to the specified directory and all its
|
|
152
148
|
* subdirectories, unless overridden or blocked at a deeper level.
|
|
153
149
|
*
|
|
154
|
-
* @param key - Environment variable name. Must match `^[A-
|
|
150
|
+
* @param key - Environment variable name. Must match `^[A-Za-z_][A-Za-z0-9_]*$`
|
|
155
151
|
* @param value - Secret value to store
|
|
156
152
|
* @param options - Set options including target path
|
|
157
153
|
* @throws Error if the key format is invalid
|
|
@@ -215,7 +211,7 @@ export declare class BurrowClient {
|
|
|
215
211
|
*
|
|
216
212
|
* A blocked key can be re-enabled by calling `set` at the same or deeper path.
|
|
217
213
|
*
|
|
218
|
-
* @param key - Environment variable name to block. Must match `^[A-
|
|
214
|
+
* @param key - Environment variable name to block. Must match `^[A-Za-z_][A-Za-z0-9_]*$`
|
|
219
215
|
* @param options - Block options including target path
|
|
220
216
|
* @throws Error if the key format is invalid
|
|
221
217
|
*
|
|
@@ -240,7 +236,7 @@ export declare class BurrowClient {
|
|
|
240
236
|
* `remove` completely deletes the secret entry. After removal, the key
|
|
241
237
|
* may still be inherited from parent directories if defined there.
|
|
242
238
|
*
|
|
243
|
-
* @param key - Environment variable name to remove. Must match `^[A-
|
|
239
|
+
* @param key - Environment variable name to remove. Must match `^[A-Za-z_][A-Za-z0-9_]*$`
|
|
244
240
|
* @param options - Remove options including target path
|
|
245
241
|
* @returns true if the secret was found and removed, false if it didn't exist
|
|
246
242
|
* @throws Error if the key format is invalid
|