MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / addSecretToConfig

Function addSecretToConfig

packages/core/config/src/write.ts:142–157  ·  view source on GitHub ↗
(
  path: string,
  secretId: string,
  metadata: { name: string; provider?: string; purpose?: string },
)

Source from the content-addressed store, hash-verified

140 * Add secret metadata to the config file.
141 */
142export const addSecretToConfig = (
143 path: string,
144 secretId: string,
145 metadata: { name: string; provider?: string; purpose?: string },
146): Effect.Effect<void, PlatformError, FileSystem.FileSystem> =>
147 Effect.gen(function* () {
148 const fs = yield* FileSystem.FileSystem;
149 let text = yield* readOrCreate(fs, path);
150
151 const edits = jsonc.modify(text, ["secrets", secretId], metadata, {
152 formattingOptions: FORMATTING,
153 });
154 text = jsonc.applyEdits(text, edits);
155
156 yield* fs.writeFileString(path, text);
157 });
158
159/**
160 * Remove secret metadata from the config file.

Callers 1

config.test.tsFile · 0.90

Calls 1

readOrCreateFunction · 0.85

Tested by

no test coverage detected