https://github.com/sgaunet/dsn
golang library to handle data source name : scheme://user:password@host:port/dbname&sslmode=disable
https://github.com/sgaunet/dsn
cli data-source-name dsn golang library
Last synced: over 1 year ago
JSON representation
golang library to handle data source name : scheme://user:password@host:port/dbname&sslmode=disable
- Host: GitHub
- URL: https://github.com/sgaunet/dsn
- Owner: sgaunet
- License: mit
- Created: 2022-10-03T18:36:05.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-02-23T19:57:06.000Z (over 1 year ago)
- Last Synced: 2025-02-23T20:32:59.051Z (over 1 year ago)
- Topics: cli, data-source-name, dsn, golang, library
- Language: Go
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://goreportcard.com/report/github.com/sgaunet/dsn)



# dsn
Tiny library to handle data source name : scheme://user:password@host:port/dbname&sslmode=disable
It's really dumb but useful for me at least.
And now it's a binary that can be used in bash script.
```
$ eval $(dsn setenv --d "pg://login:password@host/mydb?timeout=1000" --pr DB_)
$ echo $DB_HOST
host
```
# Install
## Option 1
* Download the release
* Install the binary in /usr/local/bin
## Option 2: With brew
```
brew tap sgaunet/homebrew-tools
brew install sgaunet/tools/dsn
```
## Option 3: Docker image
Possibility to copy the binary by using the docker image
```
FROM sgaunet/dsn:latest as builder
FROM ....
COPY --from builder /dsn /usr/bin/dsn
```
# Development
This project is using :
* golang 1.19+
* [task for development](https://taskfile.dev/#/)
* docker
* [docker buildx](https://github.com/docker/buildx)
* docker manifest
* [goreleaser](https://goreleaser.com/)
The docker image is only created to simplify the copy of dsn in another docker image.