diff options
| author | Samuel Johnson <[email protected]> | 2025-11-24 00:38:12 -0500 |
|---|---|---|
| committer | Samuel Johnson <[email protected]> | 2025-11-24 00:38:12 -0500 |
| commit | 177663c73f3d708120b975a74eebd0951177a53b (patch) | |
| tree | 9629bfced318c645496a31cc7844c7840605113c /cmd/parser | |
| parent | 1692aea0951f1d46af01211bd3e32920c443505f (diff) | |
Add blog posts to front page
Diffstat (limited to 'cmd/parser')
| -rw-r--r-- | cmd/parser/main.go | 9 |
1 files changed, 6 insertions, 3 deletions
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 { |
