|
|
@@ -2,8 +2,6 @@ package gorm
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
- "os"
|
|
|
- "strconv"
|
|
|
|
|
|
"github.com/porter-dev/porter/internal/config"
|
|
|
"gorm.io/driver/postgres"
|
|
|
@@ -13,6 +11,10 @@ import (
|
|
|
|
|
|
// New returns a new gorm database instance
|
|
|
func New(conf *config.DBConf) (*gorm.DB, error) {
|
|
|
+ if conf.SQLLite {
|
|
|
+ return gorm.Open(sqlite.Open("./internal/porter.db"), &gorm.Config{})
|
|
|
+ }
|
|
|
+
|
|
|
dsn := fmt.Sprintf(
|
|
|
"user=%s password=%s port=%d host=%s sslmode=disable",
|
|
|
conf.Username,
|
|
|
@@ -21,10 +23,5 @@ func New(conf *config.DBConf) (*gorm.DB, error) {
|
|
|
conf.Host,
|
|
|
)
|
|
|
|
|
|
- if quickstart, _ := strconv.ParseBool(os.Getenv("QUICK_START")); quickstart {
|
|
|
- return gorm.Open(sqlite.Open("./internal/porter.db"), &gorm.Config{})
|
|
|
- } else {
|
|
|
- return gorm.Open(postgres.Open(dsn), &gorm.Config{})
|
|
|
- }
|
|
|
-
|
|
|
+ return gorm.Open(postgres.Open(dsn), &gorm.Config{})
|
|
|
}
|