From 177663c73f3d708120b975a74eebd0951177a53b Mon Sep 17 00:00:00 2001 From: Samuel Johnson Date: Mon, 24 Nov 2025 00:38:12 -0500 Subject: Add blog posts to front page --- cmd/parser/main.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'cmd/parser/main.go') diff --git a/cmd/parser/main.go b/cmd/parser/main.go index c9c80c8..bf79439 100644 --- a/cmd/parser/main.go +++ b/cmd/parser/main.go @@ -104,8 +104,11 @@ func main() { ), ) - host := "localhost" - port := 5432 + host := os.Getenv("db_host") + port, err := strconv.ParseUint(os.Getenv("db_port"), 10, 64) + if err != nil { + port = 5432 + } dbName := os.Getenv("db_name") user := os.Getenv("db_user") pass := os.Getenv("db_pass") @@ -131,7 +134,7 @@ func main() { passOne := os.Getenv("blog_pass1") passTwo := os.Getenv("blog_pass2") - _, table_check = db.Query("SELECT * FROM users;") + _, table_check = db.Query("SELECT * FROM logins;") if table_check != nil { _, err = db.Exec("CREATE TABLE logins (id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, time DATE DEFAULT CURRENT_DATE, pass_one TEXT NOT NULL, pass_two TEXT NOT NULL);") if err != nil { -- cgit v1.2.3