aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2024-01-10 22:22:11 -0500
committerEugene Triguba <eugenetriguba@gmail.com>2024-01-10 22:22:11 -0500
commit1f2d3ef1ca48aad4998e3a7ba095957f59bd1403 (patch)
tree3116c333fa5b9fa033f10875443097600a9dd63d
parentTweak tests (diff)
downloadcli-1f2d3ef1ca48aad4998e3a7ba095957f59bd1403.zip
tweak env/docker compose file
-rw-r--r--.env.bolt-postgres6
-rwxr-xr-xbolt2
-rw-r--r--bolt.toml9
-rw-r--r--docker-compose.yml8
-rw-r--r--internal/storage/db.go4
5 files changed, 10 insertions, 19 deletions
diff --git a/.env.bolt-postgres b/.env.bolt-postgres
new file mode 100644
index 0000000..af4ec5e
--- /dev/null
+++ b/.env.bolt-postgres
@@ -0,0 +1,6 @@
+BOLT_CONNECTION_DBNAME=test_db
+BOLT_CONNECTION_HOST=bolt_postgres_db
+BOLT_CONNECTION_PORT=5432
+BOLT_CONNECTION_USER=test_user
+BOLT_CONNECTION_PASSWORD=testpassword
+BOLT_CONNECTION_DRIVER=postgres
diff --git a/bolt b/bolt
new file mode 100755
index 0000000..34a3a59
--- /dev/null
+++ b/bolt
@@ -0,0 +1,2 @@
+#!/bin/sh
+env $(cat .env.bolt-postgres | xargs) go run ./cmd/bolt/bolt.go
diff --git a/bolt.toml b/bolt.toml
deleted file mode 100644
index 0a40fa9..0000000
--- a/bolt.toml
+++ /dev/null
@@ -1,9 +0,0 @@
-migrations_dir = "migrations"
-
-[connection]
-host = "localhost"
-port = 5839
-user = "test_user"
-password = "testpassword"
-dbname = "test_db"
-driver = "postgres"
diff --git a/docker-compose.yml b/docker-compose.yml
index d6c4384..b4d3679 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -12,8 +12,6 @@ services:
context: .
volumes:
- ./:/app
- networks:
- - app
depends_on:
- postgres_db
@@ -26,13 +24,7 @@ services:
- POSTGRES_PASSWORD=${DB_PASSWORD:?err}
volumes:
- postgres_db_volume:/var/lib/postgresql/data
- networks:
- - app
volumes:
postgres_db_volume:
name: postgres-db-volume
-
-networks:
- app:
- name: app
diff --git a/internal/storage/db.go b/internal/storage/db.go
index 25db283..9032dc3 100644
--- a/internal/storage/db.go
+++ b/internal/storage/db.go
@@ -12,8 +12,8 @@ import (
// and connection information.
//
// Note that only "postgres" is supported as the driver right now.
-func DBConnect(driver string, connectionInfo string) (*sql.DB, error) {
- db, err := sql.Open(driver, connectionInfo)
+func DBConnect(driver string, connectionParams string) (*sql.DB, error) {
+ db, err := sql.Open(driver, connectionParams)
if err != nil {
return nil, err
}