INNER CODE UNIT · Go
GetProxyUrlRedacted
kimdre/doco-cd · cmd/doco-cd/main.go:50
func GetProxyUrlRedacted(proxyUrl string) string {
// Hide password in the proxy URL if it exists (between the second ':' and the @)
if strings.Contains(proxyUrl, "@") {
re := regexp.MustCompile(`://([^:]+):([^@]+)@`)
proxyUrl = re.ReplaceAllString(proxyUrl, "://$1:***@")
} else {
re := regexp.MustCompile(`://([^@]+)@`)
proxyUrl = re.ReplaceAllString(proxyUrl, "://$1@")
}
return proxyUrl
}
// CreateMountpointSymlink creates the Symlink for the data mount point to reflect the data volume path in the container.
// Required so that the docker cli client is able to read/parse certain files (like .env files) in docker.LoadCompose.
func CreateMountpointSymlink(m container.MountPoint) error {
// if source ends with `/` path.Dir will like remove `/`,
// like `/data/dococd/` -> /data/dococd which is not what we want.