Class: Shipitron::Server::Git::Configure

Inherits:
Object
  • Object
show all
Includes:
Metaractor, ConsulKeys
Defined in:
lib/shipitron/server/git/configure.rb

Instance Method Summary collapse

Methods included from ConsulKeys

#configure_consul_client!, #fetch_key, #fetch_key!, #set_key, #set_key!

Instance Method Details

#callObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/shipitron/server/git/configure.rb', line 19

def call
  host_key = fetch_key!(key: "shipitron/#{application}/git_host_key")
  Pathname.new('/home/shipitron/.ssh/known_hosts').open('a') do |file|
    file.puts(host_key.to_s)
  end

  deploy_key = fetch_key!(key: "shipitron/#{application}/git_deploy_key")
  Pathname.new('/home/shipitron/.ssh/id_rsa').open('w') do |file|
    file.puts(deploy_key.to_s)
    file.chmod(0600)
  end
end