Class: BradyW::Database
- Inherits:
-
Object
- Object
- BradyW::Database
- Defined in:
- lib/database.rb
Overview
TODO: Merge this in with Base_Config Retrieves database related settings from our YAML configuration files
Constant Summary collapse
- CREDENTIALS =
[:system, :objectcreation, :general]
Instance Method Summary collapse
-
#connect_code ⇒ Object
Using the template in the YAML files, produces a .NET connect string.
-
#host ⇒ Object
The hostname where the database lives (db: => hostname:).
-
#initialize ⇒ Database
constructor
A new instance of Database.
-
#name ⇒ Object
The name of the database/catalog (db: => name:).
-
#password ⇒ Object
General user’s password.
-
#user ⇒ Object
General user’s username.
Constructor Details
Instance Method Details
#connect_code ⇒ Object
Using the template in the YAML files, produces a .NET connect string
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/database.rb', line 46 def connect_code if @config.db_general_authmode == :winauth @config.db_connect_string_winauth.gsub(/@host@/, host). gsub(/@initialcatalog@/, name) else @config.db_connect_string_sqlauth.gsub(/@host@/, host). gsub(/@initialcatalog@/, name). gsub(/@user@/, user). gsub(/@password@/, @config.db_general_password) end end |
#host ⇒ Object
The hostname where the database lives (db: => hostname:)
24 25 26 |
# File 'lib/database.rb', line 24 def host @config.db_hostname end |
#name ⇒ Object
The name of the database/catalog (db: => name:)
29 30 31 32 |
# File 'lib/database.rb', line 29 def name @config.db_name.gsub(/@thismachinehostname@/, Socket.gethostname). gsub(/@prefix@/, prefix) end |
#password ⇒ Object
General user’s password
41 42 43 |
# File 'lib/database.rb', line 41 def password @config.db_general_password end |
#user ⇒ Object
General user’s username
35 36 37 38 |
# File 'lib/database.rb', line 35 def user @config.db_general_user.gsub(/@thismachinehostname@/, Socket.gethostname). gsub(/@prefix@/, prefix) end |