Class: Kamal::EnvFile
- Inherits:
-
Object
- Object
- Kamal::EnvFile
- Defined in:
- lib/kamal/env_file.rb
Overview
Encode an env hash as a string where secret values have been looked up and all values escaped for Docker.
Instance Method Summary collapse
-
#initialize(env) ⇒ EnvFile
constructor
A new instance of EnvFile.
- #to_io ⇒ Object
- #to_s ⇒ Object (also: #to_str)
Constructor Details
#initialize(env) ⇒ EnvFile
Returns a new instance of EnvFile.
3 4 5 |
# File 'lib/kamal/env_file.rb', line 3 def initialize(env) @env = env end |
Instance Method Details
#to_io ⇒ Object
18 19 20 |
# File 'lib/kamal/env_file.rb', line 18 def to_io StringIO.new(to_s) end |
#to_s ⇒ Object Also known as: to_str
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/kamal/env_file.rb', line 7 def to_s env_file = StringIO.new.tap do |contents| @env.each do |key, value| contents << docker_env_file_line(key, value) end end.string # Ensure the file has some contents to avoid the SSHKIT empty file warning env_file.presence || "\n" end |