Sha256: 52b90fd885c1f2b77f548407cc43b4a9c8e79edc95d74c1d026a328efeccb785

Contents?: true

Size: 930 Bytes

Versions: 8

Compression:

Stored size: 930 Bytes

Contents

require 'shipitron'
require 'shipitron/consul_keys'

module Shipitron
  module Server
    module Git
      class Configure
        include Metaractor
        include ConsulKeys

        required :application
        required :repository_url
        required :s3_cache_bucket

        before do
          configure_consul_client!
        end

        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

        private
        def application
          context.application
        end

      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shipitron-0.3.5 lib/shipitron/server/git/configure.rb
shipitron-0.3.4 lib/shipitron/server/git/configure.rb
shipitron-0.3.3 lib/shipitron/server/git/configure.rb
shipitron-0.3.1 lib/shipitron/server/git/configure.rb
shipitron-0.3.0 lib/shipitron/server/git/configure.rb
shipitron-0.2.2 lib/shipitron/server/git/configure.rb
shipitron-0.2.1 lib/shipitron/server/git/configure.rb
shipitron-0.2.0 lib/shipitron/server/git/configure.rb