summaryrefslogtreecommitdiff
path: root/app/db/url.go
blob: b17c6516617db4d63527977b3eab54e1fa4af90e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package db

import (
	"fmt"

	"github.com/xlgmokha/x/pkg/env"
)

func URL() string {
	if url := env.Fetch("DATABASE_URL", ""); url != "" {
		return url
	}

	return fmt.Sprintf(
		"postgresql://postgres:%s@localhost:5000/%s?sslmode=disable",
		env.Fetch("RUNWAY_PG_USER_POSTGRES_PASSWORD_SPARKLE", ""),
		env.Fetch("DATABASE_NAME", "sparkle"),
	)
}