Skip to content

Commit

Permalink
set DSN from Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
denpeshkov committed Feb 18, 2024
1 parent 4b62350 commit 5c4f884
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ test/cover: ## Test and cover
run: ## build and run app
go vet ./...
go build -race -o ./bin/greenlight ./cmd/greenlight
./bin/greenlight -addr=:8080 -token-secret=my_secret
./bin/greenlight -addr=:8080 -dsn=${POSTGRES_DSN} -token-secret=my_secret
2 changes: 1 addition & 1 deletion cmd/greenlight/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (c *Config) parseFlags(args []string) error {
fs.IntVar(&c.limiter.burst, "limiter-burst", 4, "Rate limiter maximum burst")

// PostgreSQL
fs.StringVar(&c.pgDB.dsn, "dsn", os.Getenv("POSTGRES_DSN"), "PostgreSQL DSN")
fs.StringVar(&c.pgDB.dsn, "dsn", "", "PostgreSQL DSN")
fs.IntVar(&c.pgDB.maxOpenConns, "db-max-open-conns", 25, "PostgreSQL max open connections")
fs.IntVar(&c.pgDB.maxIdleConns, "db-max-idle-conns", 25, "PostgreSQL max idle connections")
fs.DurationVar(&c.pgDB.maxIdleTime, "db-max-idle-time", 15*time.Minute, "PostgreSQL max connection idle time")
Expand Down

0 comments on commit 5c4f884

Please sign in to comment.