dbprovider/dbprovider.go
func InitDbProvider(name string, configFilePath string) (DbInterface, error) {
	var dbprovider DbInterface

	if name == "" {
		logger.Get().Info("No providers specified.")
		return nil, nil
	}

	var err error

	if configFilePath != "" {
		config, err := os.Open(configFilePath)
		if err != nil {
			logger.Get().Critical("Couldn't open Db provider configuration %s: %v",
				configFilePath, err)
		}

		defer config.Close()
		dbprovider, err = GetDbProvider(name, config)
	} else {
		// Pass explicit nil so providers can actually check for nil. See
		// "Why is my nil error value not equal to nil?" in golang.org/doc/faq.
		dbprovider, err = GetDbProvider(name, nil)
	}

	if err != nil {
		return nil, fmt.Errorf("could not initialize Db Provider %q: %v", name, err)
	}
	if dbprovider == nil {
		return nil, fmt.Errorf("unknown Db Provider %q", name)
	}

	return dbprovider, nil
}
func InitDbProvider(name string, configFilePath string) (DbInterface, error) {
	var dbprovider DbInterface

	if name == "" {
		logger.Get().Info("No providers specified.")
		return nil, nil
	}

	var err error

	if configFilePath != "" {
		config, err := os.Open(configFilePath)
		if err != nil {
			logger.Get().Critical("Couldn't open Db provider configuration %s: %v",
				configFilePath, err)
		}

		defer config.Close()
		dbprovider, err = GetDbProvider(name, config)
	} else {
		// Pass explicit nil so providers can actually check for nil. See
		// "Why is my nil error value not equal to nil?" in golang.org/doc/faq.
		dbprovider, err = GetDbProvider(name, nil)
	}

	if err != nil {
		return nil, fmt.Errorf("could not initialize Db Provider %q: %v", name, err)
	}
	if dbprovider == nil {
		return nil, fmt.Errorf("unknown Db Provider %q", name)
	}

	return dbprovider, nil
}
// InitPlugin creates an instance of the named plugin.