Sha256: 9d555cbe7e5c39be4fe49780681b949a6a08bb565097d3fe57cd650cd0016595

Contents?: true

Size: 867 Bytes

Versions: 2

Compression:

Stored size: 867 Bytes

Contents

module FlydataCore
  module Mysql
    class Config
      def self.build_mysql_db_opts(db_conf)
        db_opts = [:host,
                   :port,
                   :username,
                   :password,
                   :database,
                   :ssl_ca,
                   :ssl_cipher].inject({}) { |h, sym|
                     h[sym] = if db_conf.has_key?(sym)
                                db_conf[sym]
                              else
                                db_conf[sym.to_s]
                              end
                     h
                   }

        # for mysql2 gem
        unless db_opts[:ssl_ca].to_s.empty?
          db_opts[:sslca] = db_opts[:ssl_ca]
        end
        unless db_opts[:ssl_cipher].to_s.empty?
          db_opts[:sslcipher] = db_opts[:ssl_cipher]
        end

        db_opts
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flydata-0.5.7 flydata-core/lib/flydata-core/mysql/config.rb
flydata-0.5.6 flydata-core/lib/flydata-core/mysql/config.rb