Sha256: c4372a620edb88dcf8153189f1cac30c66ba6fe8b4378d99b2d09c9893043d53

Contents?: true

Size: 1.79 KB

Versions: 36

Compression:

Stored size: 1.79 KB

Contents

module Appfuel
  module Config
    # Defines database configuration. This is designed to hold more than one
    # database connection which is why they are named invidually. We are using
    # active record so the config is taylored to that style connection.
    #
    # Configuration Overview
    #
    # pool:     Managed connection which controls the amount of thread access to
    #           a limited number of database connections
    # adapter:  We always use postgres, rarely changes
    # encoding: We always use unicode, rarely changes
    # database  Name of the database
    # username  Name of the database user
    # password  Database password
    # host      Location of the database server
    #
    # @return Defintion
    def self.db_definition
      define :db do
        validator {
          required(:main).filled(:hash?)
          required(:path).filled(:str?)
          required(:seed_path).filled(:str?)
          required(:migrations_path).filled(:str?)
        }

        db_path = 'db'
        defaults path: db_path,
          migrations_path: "#{db_path}/migrations",
          seed_path: 'db/seed'

        define :main do
          defaults pool:     5,
            adapter: 'postgresql',
            encoding: 'unicode',
            schema_format: 'sql'

          validator do
            required(:schema_search_path).filled(:str?)
            required(:schema_format).filled(:str?)
            required(:database).filled(:str?)
            required(:username).filled(:str?)
            required(:password).filled(:str?)
            required(:host).filled(:str?)
            required(:adapter).filled(:str?)
            optional(:pool).filled(:int?)
            optional(:encoding).filled(:str?)
            optional(:port).filled(:int?)
          end
        end
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
appfuel-0.7.0 lib/appfuel/config/db.rb
appfuel-0.6.16 lib/appfuel/config/db.rb
appfuel-0.6.15 lib/appfuel/config/db.rb
appfuel-0.6.14 lib/appfuel/config/db.rb
appfuel-0.6.13 lib/appfuel/config/db.rb
appfuel-0.6.12 lib/appfuel/config/db.rb
appfuel-0.6.11 lib/appfuel/config/db.rb
appfuel-0.6.10 lib/appfuel/config/db.rb
appfuel-0.6.9 lib/appfuel/config/db.rb
appfuel-0.6.8 lib/appfuel/config/db.rb
appfuel-0.6.7 lib/appfuel/config/db.rb
appfuel-0.6.6 lib/appfuel/config/db.rb
appfuel-0.6.5 lib/appfuel/config/db.rb
appfuel-0.6.4 lib/appfuel/config/db.rb
appfuel-0.6.3 lib/appfuel/config/db.rb
appfuel-0.6.1 lib/appfuel/config/db.rb
appfuel-0.5.16 lib/appfuel/config/db.rb
appfuel-0.5.15 lib/appfuel/config/db.rb
appfuel-0.5.14 lib/appfuel/config/db.rb
appfuel-0.5.13 lib/appfuel/config/db.rb