Add support for PostgreSQL as a DB storage back-end (#431)

This commit is contained in:
sadayuki-matsuno
2017-06-20 17:29:44 +09:00
committed by Kota Kanbe
parent fecd1ad464
commit 067a2315df
7 changed files with 61 additions and 32 deletions

View File

@@ -47,7 +47,7 @@ func (api *cvedictClient) initialize() {
}
func (api cvedictClient) CheckHealth() (ok bool, err error) {
if config.Conf.CveDBURL == "" || config.Conf.CveDBType == "mysql" {
if config.Conf.CveDBURL == "" || config.Conf.CveDBType == "mysql" || config.Conf.CveDBType == "postgres" {
util.Log.Debugf("get cve-dictionary from %s", config.Conf.CveDBType)
return true, nil
}
@@ -71,7 +71,7 @@ type response struct {
func (api cvedictClient) FetchCveDetails(cveIDs []string) (cveDetails cve.CveDetails, err error) {
switch config.Conf.CveDBType {
case "sqlite3", "mysql":
case "sqlite3", "mysql", "postgres":
return api.FetchCveDetailsFromCveDB(cveIDs)
}
@@ -198,7 +198,7 @@ type responseGetCveDetailByCpeName struct {
func (api cvedictClient) FetchCveDetailsByCpeName(cpeName string) ([]cve.CveDetail, error) {
switch config.Conf.CveDBType {
case "sqlite3", "mysql":
case "sqlite3", "mysql", "postgres":
return api.FetchCveDetailsByCpeNameFromDB(cpeName)
}