Skip to content

Commit

Permalink
Merge pull request #372 from veebkolm
Browse files Browse the repository at this point in the history
Set parameters for gpg encryption
  • Loading branch information
sebastianfeldmann authored Mar 22, 2024
2 parents 891c407 + 7492c22 commit 9f4873e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Backup/Crypter/Gpg.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function setup(array $options = [])

$this->pathToGpg = Util\Arr::getValue($options, 'pathToOpenSSL', '');
$this->keepUncrypted = Util\Str::toBoolean(Util\Arr::getValue($options, 'keepUncrypted', ''), false);
$this->user = $this->toAbsolutePath(Util\Arr::getValue($options, 'user', ''));
$this->user = Util\Arr::getValue($options, 'user', '');
}

/**
Expand Down
14 changes: 14 additions & 0 deletions src/Cli/Executable/Gpg.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,26 @@ protected function createCommandLine(): CommandLine
$cmd = new Cmd($this->binary);

$process->addCommand($cmd);
$this->setOptions($cmd);

$this->addDeleteCommand($process);

return $process;
}

/**
* Set the gpg command line options
*
* @param \SebastianFeldmann\Cli\Command\Executable $cmd
*/
protected function setOptions(Cmd $cmd): void
{
$cmd->addOption('--' . ($this->action === 'e' ? 'encrypt' : 'decrypt'));
$cmd->addOption('-r', $this->user, ' ');
$cmd->addOption('-o', $this->targetFile, ' ');
$cmd->addArgument($this->sourceFile);
}

/**
* Add the 'rm' command to remove the uncrypted file
*
Expand Down

0 comments on commit 9f4873e

Please sign in to comment.