From f59c3a53ef743a2adfbc4084dd8d2ae91d8d9e92 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Wed, 8 Jan 2025 10:56:59 +0300 Subject: [PATCH] allow the BuildConnStr to be accessed by different packages --- internal/storage/storageservice.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/storage/storageservice.go b/internal/storage/storageservice.go index d252383..d333a05 100644 --- a/internal/storage/storageservice.go +++ b/internal/storage/storageservice.go @@ -36,7 +36,7 @@ type MenuStorageService struct { userDataStore db.Db } -func buildConnStr() string { +func BuildConnStr() string { host := initializers.GetEnv("DB_HOST", "localhost") user := initializers.GetEnv("DB_USER", "postgres") password := initializers.GetEnv("DB_PASSWORD", "") @@ -78,7 +78,7 @@ func (ms *MenuStorageService) getOrCreateDb(ctx context.Context, existingDb db.D var err error if database == "postgres" { - connStr := buildConnStr() + connStr := BuildConnStr() // Ensure the schema exists err = ensureSchemaExists(ctx, connStr, schema)