package test_helpers

import "github.com/pivotal-cf-experimental/cf-mysql-quota-enforcer/database"

func NewRootDatabaseConfig(dbName string) database.Config {
	return database.Config{
		Host:     "127.0.0.1",
		Port:     3306,
		User:     "root",
		Password: "password",
		DBName:   dbName,
	}
}

package test_helpers

import (
	"os"

	"github.com/pivotal-cf-experimental/cf-mysql-quota-enforcer/config"
	"github.com/pivotal-cf-experimental/cf-mysql-quota-enforcer/database"
)

func NewRootDatabaseConfig(dbName string) database.Config {
	configPath := os.Getenv("CONFIG")
	if configPath == "" {
		panic("CONFIG path must be specified")
	}

	config, err := config.Load(configPath)
	if err != nil {
		panic(err.Error())
	}

	return database.Config{
		Host:     config.Host,
		Port:     config.Port,
		User:     config.User,
		Password: config.Password,
		DBName:   dbName,
	}
}

Load same config in test as in main.
Load same config in test as in main.

[#88665590]
