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