Sha256: bfb960d72e0a3177116d00b63a6349b371ee6bee95acfdd4a1568a17d28f0720

Contents?: true

Size: 1.29 KB

Versions: 17

Compression:

Stored size: 1.29 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)
            vitur_host = cs_credentials&.fetch(:vitur_host, 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

            unless vitur_host.nil?
              ENV["CS_VITUR_HOST"] = vitur_host
            end
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
activerecord-cipherstash-pg-adapter-0.8.5 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.8.4 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.8.3 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.8.2 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.8.1 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.8.0 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.19 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.18 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.17 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.16 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.15 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.14 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.12 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.11 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.10 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.9 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb
activerecord-cipherstash-pg-adapter-0.7.8 lib/active_record/connection_adapters/cipherstash_pg/railtie.rb