// Initialize the DB connection.
Initialize the DB connection.
// Initialize the DB connection .
func initDBConn() {
	dbUserName := getEnv("POSTGRES_USER", "console")
	dbName := getEnv("POSTGRES_DB", "service_db")
	dbHostName := getEnv("POSTGRES_HOST", "console-data-cray-console-data-postgres")
	dbPort := getEnv("POSTGRES_PORT", "5432")
	dbPasswd := getEnv("POSTGRES_PASSWD", "")
	connStr := fmt.Sprintf("sslmode=disable user=%s dbname=%s host=%s port=%s", dbUserName, dbName,
		dbHostName, dbPort)
	log.Printf("Attempt to open DB conn as: %s", connStr)
	connStr += " password=" + dbPasswd
	var err error
	DB, err = sql.Open("postgres", connStr)
	if err != nil {
		log.Panicf("Unable to open DB connection: %s", err)
	}
	log.Printf("Opened DB conn")
}
func initDBConn ( ) { dbUserName := getEnv ( " " , " " ) dbName := getEnv ( " " , " " ) dbHostName := getEnv ( " " , " " ) dbPort := getEnv ( " " , " " ) dbPasswd := getEnv ( " " , " " ) connStr := fmt . Sprintf ( " " , dbUserName , dbName , dbHostName , dbPort ) log . Printf ( " " , connStr ) connStr += " " + dbPasswd var err error DB , err = sql . Open ( " " , connStr ) if err != nil { log . Panicf ( " " , err ) } log . Printf ( " " ) }
Initialize the DB connection.
Initialize the DB connection .