Sha256: a1c6b20524980937a676275a4d003ba814a916dd13c4eb21ea5a2e92cd1a93ea

Contents?: true

Size: 1.93 KB

Versions: 4

Compression:

Stored size: 1.93 KB

Contents

module Appfuel
  module Service
    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
        Appfuel::Configuration.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
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
appfuel-service-0.1.7 lib/appfuel/service/config/database.rb
appfuel-service-0.1.6 lib/appfuel/service/config/database.rb
appfuel-service-0.1.4 lib/appfuel/service/config/database.rb
appfuel-service-0.1.3 lib/appfuel/service/config/database.rb