class RubyYacht::Database

This class stores the configuration for a project’s database server.

You can configure a database with RubyYacht::Database::DSL

Attributes

container_label[RW]

The database-specific part of the container name for this database.

host[RW]

The host that the database server is accessed on.

name[RW]

The name of the database

password[RW]

The password we use to connect to the database

port[RW]

The port the database server should listen on.

server_type[RW]

The type of database server we’re using.

username[RW]

The username we use to connect to the database

Public Instance Methods

apps() click to toggle source

The apps that connect to this database.

# File lib/ruby_yacht/dsl/database.rb, line 38
def apps
  project.apps.select { |app| app.database_name == self.name }
end
container_name() click to toggle source

This method gets the name of the container and image for this database.

This will be the project’s prefix followed by the database’s container label.

# File lib/ruby_yacht/dsl/database.rb, line 46
def container_name
  "#{project.system_prefix}-#{container_label}"
end
local?() click to toggle source

Whether the database is running on the same machine as the app servers.

# File lib/ruby_yacht/dsl/database.rb, line 28
def local?
  host == 'localhost'
end
project() click to toggle source

The project that contains this database.

# File lib/ruby_yacht/dsl/database.rb, line 33
def project
  RubyYacht.configuration.projects.find { |project| project.databases.include?(self) }
end