Sha256: 4c20646c9b0d194c3c7640f5e56eb19763835645c2cfa3c22e279123fd155056

Contents?: true

Size: 1.13 KB

Versions: 9

Compression:

Stored size: 1.13 KB

Contents

require 'rails'

module ActiveRecord
  module ConnectionAdapters
    module CipherStashPG
      class Railtie < ::Rails::Railtie
        rake_tasks do
          load "cipherstash_tasks.rake"
        end

        initializer "postgres_cipherstash_adapter.configure" do
          if defined?(Rails.application.credentials)
            cs_credentials = Rails.application.credentials.try(:cipherstash)

            client_id = cs_credentials&.fetch(:client_id, nil)
            client_key = cs_credentials&.fetch(:client_key, nil)
            workspace_id = cs_credentials&.fetch(:workspace_id, nil)
            client_access_key = cs_credentials&.fetch(:client_access_key, nil)

            unless client_id.nil?
              ENV["CS_CLIENT_ID"] = client_id
            end

            unless client_key.nil?
              ENV["CS_CLIENT_KEY"] = client_key
            end

            unless workspace_id.nil?
              ENV["CS_WORKSPACE_ID"] = workspace_id
            end

            unless client_access_key.nil?
              ENV["CS_CLIENT_ACCESS_KEY"] = client_access_key
            end
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activerecord-cipherstash-pg-adapter-0.7.7 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.6 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.5 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.4 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.3 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.2 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.1 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.0 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.6.1 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb