Skip to content

Commit

Permalink
Merge pull request #2 from GreenmaskIO/fix_version_and_dsn
Browse files Browse the repository at this point in the history
Fix version and dsn
  • Loading branch information
wwoytenko authored Jan 30, 2024
2 parents 83df484 + 704f2df commit d7d45c8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CMD_FILES = $(wildcard *.go)
TEST_FILES = $(wildcard *.go)
COVERAGE_FILE := coverage.out
VERSION ?= $(shell git tag --points-at HEAD)
LDFLAGS ?= -X main.version=$(VERSION)
LDFLAGS ?= -X github.com/greenmaskio/greenmask/cmd/greenmask/cmd.Version=$(VERSION)

.PHONY: build

Expand Down
3 changes: 0 additions & 3 deletions cmd/greenmask/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ import (
"github.com/greenmaskio/greenmask/cmd/greenmask/cmd"
)

var version string

func main() {
cmd.Version = version
if err := cmd.Execute(); err != nil {
log.Fatal().Err(err).Msg("")
}
Expand Down
5 changes: 3 additions & 2 deletions internal/db/postgres/pgdump/pgdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ type Options struct {
}

func (o *Options) GetPgDSN() (string, error) {
//return "host=localhost port=5432 user=postgres dbname=postgres", nil
if strings.Contains(o.DbName, "=") {
// URI or Standard format
if strings.HasPrefix(o.DbName, "postgresql://") || strings.Contains(o.DbName, "=") {
return o.DbName, nil
}

return fmt.Sprintf("host=%s port=%d user=%s dbname=%s", o.Host, o.Port, o.UserName, o.DbName), nil
}

Expand Down

0 comments on commit d7d45c8

Please sign in to comment.