module Arcanus
Exposes API for consumption by external Ruby applications.
Global application constants.
Defines the gem version.
Constants
- BUG_REPORT_URL
- CHEST_FILE_PATH
- EXECUTABLE_NAME
- LOCKED_KEY_PATH
- REPO_URL
- UNLOCKED_KEY_PATH
- VERSION
Public Instance Methods
chest()
click to toggle source
Returns the Arcanus
chest, providing access to encrypted secrets.
@return [Arcanus::Chest]
# File lib/arcanus.rb, line 20 def chest Arcanus.load unless @chest @chest end
load()
click to toggle source
Loads Arcanus
chest and decrypts secrets.
@param directory [String] repo directory
# File lib/arcanus.rb, line 28 def load @repo = Repo.new unless File.directory?(@repo.arcanus_dir) raise Errors::UsageError, 'Arcanus has not been initialized in this repository. ' \ 'Run `arcanus setup`' end if File.exist?(@repo.unlocked_key_path) key = Arcanus::Key.from_file(@repo.unlocked_key_path) elsif ENV['ARCANUS_PASSWORD'] key = Arcanus::Key.from_protected_file(@repo.locked_key_path, ENV['ARCANUS_PASSWORD']) else raise Errors::UsageError, 'Arcanus key has not been unlocked. ' \ 'Run `arcanus unlock` or specify password via ARCANUS_PASSWORD environment variable' end @chest = Chest.new(key: key, chest_file_path: @repo.chest_file_path) end