Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@
db, err = gorm.Open(mysql.Open(dbDSN), &gorm.Config{})
case "postgres":
log.Println("testing postgres...")
if dbDSN == "" {
dbDSN = "user=gorm password=gorm host=localhost dbname=gorm port=9920 sslmode=disable TimeZone=Asia/Shanghai"
}
// Absolutely insane but all golang psql libraries require you to pass a sslcert and key
// EVEN thought RDS does not support this. So just generate a dummy cert and key. via:
// > openssl req -x509 -newkey rsa:2048 -keyout /tmp/dummy.key -out /tmp/dummy.cert -days 365
// -nodes -subj "/C=US/ST=State/L=City/O=Organization/CN=localhost"
dbDSN := fmt.Sprintf("host=localhost port=5432 user=assembly_admin password=%s dbname=assembly_prod

Check failure on line 59 in db.go

View workflow job for this annotation

GitHub Actions / sqlite (1.24, ubuntu-latest)

syntax error: unexpected newline in argument list; possibly missing comma or )

Check failure on line 59 in db.go

View workflow job for this annotation

GitHub Actions / sqlite (1.24, ubuntu-latest)

newline in string
sslmode=require sslrootcert=%s/Documents/aws-rds-cert.pem sslcert=/tmp/dummy.cert sslkey=/tmp/
dummy.key",

Check failure on line 61 in db.go

View workflow job for this annotation

GitHub Actions / sqlite (1.24, ubuntu-latest)

newline in string
os.Getenv("PGPASSWORD"), os.Getenv("HOME"))

Check failure on line 62 in db.go

View workflow job for this annotation

GitHub Actions / sqlite (1.24, ubuntu-latest)

syntax error: unexpected ) at end of statement
db, err = gorm.Open(postgres.Open(dbDSN), &gorm.Config{})
case "sqlserver":
// CREATE LOGIN gorm WITH PASSWORD = 'LoremIpsum86';
Expand Down
Loading