Module: ConfEncrypt
- Defined in:
- lib/conf_encrypt.rb,
lib/conf_encrypt/version.rb
Constant Summary collapse
- VERSION =
"0.0.1"
Class Method Summary collapse
- .config ⇒ Object
- .decrypt ⇒ Object
- .encrypt ⇒ Object
- .file_name ⇒ Object
- .password ⇒ Object
- .path ⇒ Object
- .tar_file_name ⇒ Object
Class Method Details
.config ⇒ Object
5 6 7 |
# File 'lib/conf_encrypt.rb', line 5 def self.config @config ||= YAML.load_file('.conf_encrypt.yml') rescue {} end |
.decrypt ⇒ Object
31 32 33 34 35 |
# File 'lib/conf_encrypt.rb', line 31 def self.decrypt system("openssl aes-256-cbc -d -salt -in #{file_name} -out #{tar_file_name} -k #{password}") system("tar -xvf #{tar_file_name}") system("rm #{tar_file_name}") end |
.encrypt ⇒ Object
25 26 27 28 29 |
# File 'lib/conf_encrypt.rb', line 25 def self.encrypt system("tar cvf #{tar_file_name} #{path}") system("openssl aes-256-cbc -salt -in #{tar_file_name} -out #{file_name} -k #{password}") system("rm #{tar_file_name}") end |
.file_name ⇒ Object
13 14 15 |
# File 'lib/conf_encrypt.rb', line 13 def self.file_name config[:file_name] || ENV['CONF_ENCRYPT_FILE_NAME'] end |
.password ⇒ Object
17 18 19 |
# File 'lib/conf_encrypt.rb', line 17 def self.password config[:password] || ENV['CONF_ENCRYPT_PASSWORD'] end |
.path ⇒ Object
9 10 11 |
# File 'lib/conf_encrypt.rb', line 9 def self.path config[:path] || ENV['CONF_ENCRYPT_PATH'] end |
.tar_file_name ⇒ Object
21 22 23 |
# File 'lib/conf_encrypt.rb', line 21 def self.tar_file_name 'encrypt_tmp.tar' end |