Class VaultConfiguration

java.lang.Object
org.kiwiproject.ansible.vault.VaultConfiguration

public class VaultConfiguration extends Object
Configuration class for creating ansible-vault commands. Can be constructed via the no-arg constructor, the all-args constructor, or the builder. The builder is the preferred way to create an instance if done programmatically.

This is mutable in case it is used in injected configuration, e.g. in a Dropwizard configuration file.

Has beans validation annotations to support validation of external configuration, e.g. by Dropwizard's normal validation. But also uses explicit validation in the all-args constructor used for the Lombok builder so that invalid configurations cannot be constructed via the builder.

  • Constructor Details

    • VaultConfiguration

      public VaultConfiguration()
      No-arg constructor. Useful mainly when using an external configuration mechanism that uses setter methods.

      Sets the temporary directory to the value of the running JVM's java.io.tmpdir system property.

    • VaultConfiguration

      public VaultConfiguration(String ansibleVaultPath, String vaultPasswordFilePath, String tempDirectory)
      All-args constructor.

      If tempDirectory is blank, the temporary directory will be set to the value of the running JVM's java.io.tmpdir system property.

      Parameters:
      ansibleVaultPath - path to the ansible-vault executable
      vaultPasswordFilePath - path to the vault password file for encryption
      tempDirectory - a temporary directory used with the encrypt_string command
      Implementation Note:
      This constructor is used by the Lombok-generated builder, and therefore both this constructor and the builder perform validation on the arguments.
  • Method Details

    • copyOf

      public VaultConfiguration copyOf()
      Makes a copy of this instance.
      Returns:
      a new instance containing the same values as this instance
    • builder

    • getAnsibleVaultPath

      public String getAnsibleVaultPath()
      Path to the ansible-vault executable.
    • getVaultPasswordFilePath

      public String getVaultPasswordFilePath()
      Path to the file containing passwords to use when encrypting and decrypting with ansible-vault.
    • getTempDirectory

      public String getTempDirectory()
      A temporary directory that is used to store encrypted content when decrypting string variables via the ansible-vault encrypt_string command.
    • setAnsibleVaultPath

      public void setAnsibleVaultPath(String ansibleVaultPath)
      Path to the ansible-vault executable.
    • setVaultPasswordFilePath

      public void setVaultPasswordFilePath(String vaultPasswordFilePath)
      Path to the file containing passwords to use when encrypting and decrypting with ansible-vault.
    • setTempDirectory

      public void setTempDirectory(String tempDirectory)
      A temporary directory that is used to store encrypted content when decrypting string variables via the ansible-vault encrypt_string command.