class RubyYacht::Database::DSL
This class provides a DSL
for configuring a database.
You can access this DSL
by calling ‘database` within `RubyYacht::Project::DSL`. It will create a RubyYacht::Database
Public Class Methods
This initializer starts the DSL
for the database.
### Parameters
-
**server_type: Symbol** The type of database this is.
-
**name: String** The name of the database.
# File lib/ruby_yacht/dsl/database.rb, line 64 def initialize(server_type, name) @server_type = server_type @name = name load_custom_attributes end
Public Instance Methods
This method checks that all of the required attributes have been set on the object.
If they haven’t, this will raise an exception.
It also checks that the server type has been defined in the configuration.
RubyYacht::DSL::Base#check_required_attributes
# File lib/ruby_yacht/dsl/database.rb, line 120 def check_required_attributes super check_server_type @server_type, :database end
You can call ‘container_label ’mysql’‘ to give this database a container name that is (project)-mysql.
# File lib/ruby_yacht/dsl/database.rb, line 109 add_attribute :container_label, :database
You can call ‘host ’db.test.com’‘ to set the database’s host.
# File lib/ruby_yacht/dsl/database.rb, line 73 add_attribute :host
You can call ‘password ’testpass’‘ to tell the apps to connect to the password `testpass`.
# File lib/ruby_yacht/dsl/database.rb, line 97 add_attribute :password
You can call ‘port 1234` to tell the database server to listen on port 1234.
# File lib/ruby_yacht/dsl/database.rb, line 103 add_attribute :port
You can call ‘username ’db-user’‘ to tell the apps to connect to the database under the name `db-user`.
# File lib/ruby_yacht/dsl/database.rb, line 91 add_attribute :username