class BradyW::Database

TODO: Merge this in with Base_Config Retrieves database related settings from our YAML configuration files

Constants

CREDENTIALS

Public Class Methods

new() click to toggle source
   # File lib/database.rb
 9 def initialize
10   @config = Config.instance.values
11 end

Public Instance Methods

connect_code() click to toggle source

Using the template in the YAML files, produces a .NET connect string

   # File lib/database.rb
46 def connect_code
47   if @config.db_general_authmode == :winauth
48     @config.db_connect_string_winauth.gsub(/@host@/, host).
49         gsub(/@initialcatalog@/, name)
50   else
51     @config.db_connect_string_sqlauth.gsub(/@host@/, host).
52         gsub(/@initialcatalog@/, name).
53         gsub(/@user@/, user).
54         gsub(/@password@/, @config.db_general_password)
55   end
56 end
host() click to toggle source

The hostname where the database lives (db: => hostname:)

   # File lib/database.rb
24 def host
25   @config.db_hostname
26 end
name() click to toggle source

The name of the database/catalog (db: => name:)

   # File lib/database.rb
29 def name
30   @config.db_name.gsub(/@thismachinehostname@/, Socket.gethostname).
31       gsub(/@prefix@/, prefix)
32 end
password() click to toggle source

General user’s password

   # File lib/database.rb
41 def password
42   @config.db_general_password
43 end
user() click to toggle source

General user’s username

   # File lib/database.rb
35 def user
36   @config.db_general_user.gsub(/@thismachinehostname@/, Socket.gethostname).
37       gsub(/@prefix@/, prefix)
38 end

Private Instance Methods

prefix() click to toggle source
   # File lib/database.rb
15 def prefix
16   @config.project_prefix
17 end