aboutsummaryrefslogtreecommitdiff
path: root/cmd/parser/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/parser/main.go')
-rw-r--r--cmd/parser/main.go9
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 {