mirror of
https://github.com/optim-enterprises-bv/databunker.git
synced 2025-11-01 18:38:06 +00:00
add postgresql support
This commit is contained in:
@@ -18,6 +18,7 @@ require (
|
|||||||
github.com/hashicorp/go-uuid v1.0.3
|
github.com/hashicorp/go-uuid v1.0.3
|
||||||
github.com/julienschmidt/httprouter v1.3.0
|
github.com/julienschmidt/httprouter v1.3.0
|
||||||
github.com/kelseyhightower/envconfig v1.4.0
|
github.com/kelseyhightower/envconfig v1.4.0
|
||||||
|
github.com/lib/pq v1.10.7 // indirect
|
||||||
github.com/mattn/go-sqlite3 v1.14.15 // indirect
|
github.com/mattn/go-sqlite3 v1.14.15 // indirect
|
||||||
github.com/oschwald/geoip2-golang v1.8.0
|
github.com/oschwald/geoip2-golang v1.8.0
|
||||||
github.com/pelletier/go-toml v1.7.0 // indirect
|
github.com/pelletier/go-toml v1.7.0 // indirect
|
||||||
|
@@ -18,10 +18,6 @@ import (
|
|||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
|
||||||
allTables []string
|
|
||||||
)
|
|
||||||
|
|
||||||
// MySQL struct is used to store database object
|
// MySQL struct is used to store database object
|
||||||
type MySQLDB struct {
|
type MySQLDB struct {
|
||||||
db *sql.DB
|
db *sql.DB
|
||||||
|
1107
src/storage/pgsql-storage.go
Normal file
1107
src/storage/pgsql-storage.go
Normal file
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,10 @@ var TblName = &listTbls{
|
|||||||
Processingactivities: 9,
|
Processingactivities: 9,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
allTables []string
|
||||||
|
)
|
||||||
|
|
||||||
func GetTable(t Tbl) string {
|
func GetTable(t Tbl) string {
|
||||||
switch t {
|
switch t {
|
||||||
case TblName.Users:
|
case TblName.Users:
|
||||||
@@ -104,6 +108,11 @@ func getDBObj() BackendDB {
|
|||||||
var db BackendDB
|
var db BackendDB
|
||||||
if len(host) > 0 {
|
if len(host) > 0 {
|
||||||
db = &MySQLDB{}
|
db = &MySQLDB{}
|
||||||
|
return db
|
||||||
|
}
|
||||||
|
host = os.Getenv("PGSQL_HOST")
|
||||||
|
if len(host) > 0 {
|
||||||
|
db = &PGSQLDB{}
|
||||||
} else {
|
} else {
|
||||||
db = &SQLiteDB{}
|
db = &SQLiteDB{}
|
||||||
}
|
}
|
||||||
|
5
start-docker.sh
Executable file
5
start-docker.sh
Executable file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
docker-compose down || true
|
||||||
|
docker build -t securitybunker/databunker:latest .
|
||||||
|
docker-compose up -d
|
Reference in New Issue
Block a user