Module: Bcdatabase
- Defined in:
- lib/bcdatabase.rb,
lib/bcdatabase/cli.rb,
lib/bcdatabase/version.rb
Defined Under Namespace
Modules: Commands
Classes: CLI, DatabaseConfigurations, Error
Constant Summary
collapse
- DEFAULT_BASE_PATH =
File.join('/', 'etc', 'nubic', 'db')
- DEFAULT_PASS_FILE =
File.join('/', 'var', 'lib', 'nubic', 'db.pass')
- CIPHER =
'aes-256-ecb'
- VERSION =
'1.2.4'
Class Method Summary
collapse
Class Method Details
.decrypt(s) ⇒ Object
61
62
63
|
# File 'lib/bcdatabase.rb', line 61
def decrypt(s)
encipher(:decrypt, Base64.decode64(s))
end
|
.encrypt(s) ⇒ Object
50
51
52
53
54
55
56
57
|
# File 'lib/bcdatabase.rb', line 50
def encrypt(s)
bits = encipher(:encrypt, s)
if Base64.respond_to?(:strict_encode64)
Base64.strict_encode64(bits).strip
else
Base64.encode64(bits).gsub("\n", '').strip
end
end
|
The main entry point for Bcdatabase.
41
42
43
44
45
46
|
# File 'lib/bcdatabase.rb', line 41
def load(*args)
options = (args)
path ||= (args.first || base_path)
files = Dir.glob(File.join(path, "*.yml")) + Dir.glob(File.join(path, "*.yaml"))
DatabaseConfigurations.new(files, options[:transforms] || [])
end
|
.pass_file ⇒ Object
65
66
67
|
# File 'lib/bcdatabase.rb', line 65
def pass_file
Pathname.new(ENV["BCDATABASE_PASS"] || DEFAULT_PASS_FILE)
end
|