(
path: string,
secretId: string,
metadata: { name: string; provider?: string; purpose?: string },
)
| 140 | * Add secret metadata to the config file. |
| 141 | */ |
| 142 | export 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. |
no test coverage detected