allow the BuildConnStr to be accessed by different packages
This commit is contained in:
parent
81c3378ea6
commit
f59c3a53ef
@ -36,7 +36,7 @@ type MenuStorageService struct {
|
|||||||
userDataStore db.Db
|
userDataStore db.Db
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildConnStr() string {
|
func BuildConnStr() string {
|
||||||
host := initializers.GetEnv("DB_HOST", "localhost")
|
host := initializers.GetEnv("DB_HOST", "localhost")
|
||||||
user := initializers.GetEnv("DB_USER", "postgres")
|
user := initializers.GetEnv("DB_USER", "postgres")
|
||||||
password := initializers.GetEnv("DB_PASSWORD", "")
|
password := initializers.GetEnv("DB_PASSWORD", "")
|
||||||
@ -78,7 +78,7 @@ func (ms *MenuStorageService) getOrCreateDb(ctx context.Context, existingDb db.D
|
|||||||
var err error
|
var err error
|
||||||
|
|
||||||
if database == "postgres" {
|
if database == "postgres" {
|
||||||
connStr := buildConnStr()
|
connStr := BuildConnStr()
|
||||||
|
|
||||||
// Ensure the schema exists
|
// Ensure the schema exists
|
||||||
err = ensureSchemaExists(ctx, connStr, schema)
|
err = ensureSchemaExists(ctx, connStr, schema)
|
||||||
|
Loading…
Reference in New Issue
Block a user