2014-04-26 09:18:56 +00:00
|
|
|
package CustomerDB
|
|
|
|
|
2014-10-19 17:19:11 +00:00
|
|
|
import (
|
|
|
|
"github.com/SommerEngineering/Ocean/ConfigurationDB"
|
|
|
|
"github.com/SommerEngineering/Ocean/Log"
|
|
|
|
LM "github.com/SommerEngineering/Ocean/Log/Meta"
|
|
|
|
)
|
2014-04-26 09:18:56 +00:00
|
|
|
|
2015-06-17 15:44:52 +00:00
|
|
|
// The init function for this package.
|
2014-04-26 09:18:56 +00:00
|
|
|
func init() {
|
|
|
|
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameDATABASE, `Init the customer database.`)
|
|
|
|
|
2015-06-17 15:44:52 +00:00
|
|
|
// Read the configuration values:
|
2014-04-26 09:18:56 +00:00
|
|
|
databaseHost := ConfigurationDB.Read(`CustomerDBHost`)
|
2014-06-04 19:41:18 +00:00
|
|
|
databaseDB = ConfigurationDB.Read(`CustomerDBDatabase`)
|
|
|
|
databaseUsername = ConfigurationDB.Read(`CustomerDBUsername`)
|
|
|
|
databasePassword = ConfigurationDB.Read(`CustomerDBPassword`)
|
2014-04-26 09:18:56 +00:00
|
|
|
|
2015-06-21 18:20:27 +00:00
|
|
|
// Try to connect to the database:
|
|
|
|
connectDatabase(databaseHost, databaseUsername, databasePassword, databaseDB)
|
2014-04-26 09:18:56 +00:00
|
|
|
Log.LogShort(senderName, LM.CategorySYSTEM, LM.LevelINFO, LM.MessageNameDATABASE, `Customer database is now ready.`)
|
|
|
|
}
|