Module: Arcanus
- Defined in:
- lib/arcanus.rb,
lib/arcanus/ui.rb,
lib/arcanus/cli.rb,
lib/arcanus/key.rb,
lib/arcanus/repo.rb,
lib/arcanus/chest.rb,
lib/arcanus/input.rb,
lib/arcanus/utils.rb,
lib/arcanus/output.rb,
lib/arcanus/version.rb,
lib/arcanus/constants.rb,
lib/arcanus/subprocess.rb,
lib/arcanus/configuration.rb,
lib/arcanus/error_handler.rb
Overview
Global application constants.
Defined Under Namespace
Modules: Command, Errors, Utils Classes: CLI, Chest, Configuration, ErrorHandler, Input, Key, Output, Repo, Subprocess, UI
Constant Summary collapse
- VERSION =
'0.4.0'.freeze
- EXECUTABLE_NAME =
'arcanus'.freeze
- CHEST_FILE_PATH =
File.join('.arcanus', 'chest.yaml').freeze
- LOCKED_KEY_PATH =
File.join('.arcanus', 'protected.key').freeze
- UNLOCKED_KEY_PATH =
File.join('.arcanus', 'unprotected.key').freeze
- REPO_URL =
'https://github.com/sds/arcanus'.freeze
- BUG_REPORT_URL =
"#{REPO_URL}/issues".freeze
Class Method Summary collapse
-
.chest ⇒ Arcanus::Chest
Returns the Arcanus chest, providing access to encrypted secrets.
-
.load(directory = Dir.pwd) ⇒ Object
Loads Arcanus chest and decrypts secrets.
- .unlock(password) ⇒ Object
Class Method Details
.chest ⇒ Arcanus::Chest
Returns the Arcanus chest, providing access to encrypted secrets.
22 23 24 25 |
# File 'lib/arcanus.rb', line 22 def chest Arcanus.load unless @chest @chest end |
.load(directory = Dir.pwd) ⇒ Object
Loads Arcanus chest and decrypts secrets.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/arcanus.rb', line 30 def load(directory = Dir.pwd) @config = Configuration.load_applicable(directory) @repo = Repo.new(@config) 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.locked_key_path) elsif ENV['ARCANUS_PASSWORD'] key = Arcanus::Key.from_protected_file(@repo.locked_key_path, ENV['ARCANUS_PASSWORD']) ENV.delete('ARCANUS_PASSWORD') # Scrub so child processes don't inherit 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 |
.unlock(password) ⇒ Object
54 55 56 57 |
# File 'lib/arcanus.rb', line 54 def unlock(password) key = Arcanus::Key.from_protected_file(@repo.locked_key_path, password) key.save(key_file_path: @repo.unlocked_key_path) end |