Sha256: 74320f13b7e8eda60d432a54af08b8718b3a0832e545254d8630968a62eb0429

Contents?: true

Size: 533 Bytes

Versions: 3

Compression:

Stored size: 533 Bytes

Contents

class Publickey < ApplicationRecord
  belongs_to :user
  after_commit :do_refresh, on: [:create]

  # Updates /home/git/.ssh/authorized_keys
  # called when something added/?/etc to publickeys table 
  def do_refresh
    Rails.logger.debug "DB8 publickey.rb:def self.refresh called"
    if Publickey.all.size > 0
      File.write('/tmp/authorized_keys', Publickey.pluck(:data).join("\n") )
      system("sudo -u git cp /tmp/authorized_keys /home/git/.ssh/authorized_keys")
      File.delete('/tmp/authorized_keys')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
meroku-2.0.7 frontend/app/models/publickey.rb
meroku-2.0.6 frontend/app/models/publickey.rb
meroku-2.0.5 frontend/app/models/publickey.rb