allow the BuildConnStr to be accessed by different packages

This commit is contained in:
Alfred Kamanda 2025-01-08 10:56:59 +03:00
parent 81c3378ea6
commit f59c3a53ef
Signed by: Alfred-mk
GPG Key ID: 7EA3D01708908703

View File

@ -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)