diff options
| author | mo khan <mo@mokhan.ca> | 2025-07-31 16:09:12 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2025-07-31 16:09:12 -0600 |
| commit | 238b61113456ebad8bad880913dc315cd892a296 (patch) | |
| tree | f38db8e10c4b55aef21c96c30fc71278c6e3d5c6 /app/db/url.go | |
| parent | ebb003ef2beaeee61104d6b88a342c5c9fa73b51 (diff) | |
| parent | 311603d0c0b04d451e9fb8e5e8335dca8425e2c4 (diff) | |
Merge branch 'sparkle-visibility' into 'main'
Connect to postgresql
See merge request gitlab-org/software-supply-chain-security/authorization/sparkled!21
Diffstat (limited to 'app/db/url.go')
| -rw-r--r-- | app/db/url.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/db/url.go b/app/db/url.go new file mode 100644 index 0000000..b17c651 --- /dev/null +++ b/app/db/url.go @@ -0,0 +1,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"), + ) +} |
