Golang package for hiding information in a URI
This package can be installed with the go get command:
go get github.com/arteev/uriban
Example:
package main
import (
"flag"
"log"
"github.com/arteev/uriban"
)
var connectionString = flag.String("connection", "postgres://pqgotest:password@myhost/pqgotest?sslmode=verify-full", "connection string")
func main() {
flag.Parse()
bs := uriban.Replace(*connectionString,
uriban.WithOption(uriban.Password, uriban.ModeValue("SECRET")),
uriban.WithOption(uriban.Host, uriban.ModeValue("localhost")))
log.Printf("Connection string: %s", bs)
}
Output:
2017/10/11 13:54:14 Connection string: postgres://pqgotest:SECRET@localhost/pqgotest?sslmode=verify-full
MIT
Arteev Aleksey