feat: Working encrypt and decrypt commands.

This commit is contained in:
2024-11-30 19:27:18 -05:00
parent 81925a95d6
commit 56a406b231
7 changed files with 87 additions and 26 deletions

View File

@@ -68,13 +68,14 @@ extension CliClient: DependencyKey {
in: nil,
args
))
} else {
try await shellClient.background(.init(
shell: shell,
environment: ProcessInfo.processInfo.environment,
in: nil,
args
))
}
try await shellClient.background(.init(
shell: shell,
environment: ProcessInfo.processInfo.environment,
in: nil,
args
))
} createConfiguration: { path, json in
// Early out if a file exists at the path already.

View File

@@ -12,6 +12,7 @@ public struct Configuration: Codable, Sendable {
public let templateDir: String?
public let defaultPlaybookArgs: [String]?
public let defaultVaultArgs: [String]?
public let defaultVaultEncryptId: String?
fileprivate enum CodingKeys: String, CodingKey {
case playbookDir = "HPA_PLAYBOOK_DIR"
@@ -21,6 +22,7 @@ public struct Configuration: Codable, Sendable {
case templateDir = "HPA_TEMPLATE_DIR"
case defaultPlaybookArgs = "HPA_DEFAULT_PLAYBOOK_ARGS"
case defaultVaultArgs = "HPA_DEFAULT_VAULT_ARGS"
case defaultVaultEncryptId = "HPA_DEFAULT_VAULT_ENCRYPT_ID"
}
public static func fromEnv(
@@ -40,7 +42,8 @@ public struct Configuration: Codable, Sendable {
templateRepoVersion: hpaValues.value(for: .templateRepoVersion),
templateDir: hpaValues.value(for: .templateDir),
defaultPlaybookArgs: hpaValues.array(for: .defaultPlaybookArgs),
defaultVaultArgs: hpaValues.array(for: .defaultVaultArgs)
defaultVaultArgs: hpaValues.array(for: .defaultVaultArgs),
defaultVaultEncryptId: hpaValues.value(for: .defaultVaultEncryptId)
)
}
@@ -52,7 +55,8 @@ public struct Configuration: Codable, Sendable {
templateRepoVersion: "main",
templateDir: "/path/to/local/template",
defaultPlaybookArgs: ["--tags", "debug"],
defaultVaultArgs: ["--vault-id=myId@$SCRIPTS/vault-gopass-client"]
defaultVaultArgs: ["--vault-id=myId@$SCRIPTS/vault-gopass-client"],
defaultVaultEncryptId: "myId"
)
}