Skip to content

Commit

Permalink
docs: Fix environment variable DATABASE_URL to DSN (#1343)
Browse files Browse the repository at this point in the history
Signed-off-by: Shota Sawada <xiootas@gmail.com>
  • Loading branch information
Sawada Shota authored and aeneasr committed Apr 4, 2019
1 parent 367e94c commit f964c69
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ make test-short
Then run it with in-memory database:

```
DATABASE_URL=memory go run main.go serve all
DSN=memory go run main.go serve all
```

**Notes**
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/handler_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (h *MigrateHandler) MigrateSQL(cmd *cobra.Command, args []string) {
if len(d.Configuration().DSN()) == 0 {
fmt.Println(cmd.UsageString())
fmt.Println("")
fmt.Println("When using flag -e, environment variable DATABASE_URL must be set")
fmt.Println("When using flag -e, environment variable DSN must be set")
os.Exit(1)
return
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/migrate_sql.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ It is recommended to run this command close to the SQL instance (e.g. same subne
This decreases risk of failure and decreases time required.
You can read in the database URL using the -e flag, for example:
export DATABASE_URL=...
export DSN=...
hydra migrate sql -e
### WARNING ###
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func EnhanceMiddleware(d driver.Driver, n *negroni.Negroni, address string, rout

func isDSNAllowed(d driver.Driver) {
if d.Configuration().DSN() == "memory" {
d.Registry().Logger().Fatalf(`When using "hydra serve admin" or "hydra serve public" the DATABASE_URL can not be set to "memory".`)
d.Registry().Logger().Fatalf(`When using "hydra serve admin" or "hydra serve public" the DSN can not be set to "memory".`)
}
}

Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/go-errors/errors v1.0.1
github.com/go-openapi/analysis v0.19.0 // indirect
github.com/go-openapi/errors v0.19.0 // indirect
github.com/go-openapi/inflect v0.19.0 // indirect
github.com/go-openapi/loads v0.19.0 // indirect
github.com/go-openapi/runtime v0.19.0 // indirect
github.com/go-openapi/spec v0.19.0 // indirect
Expand All @@ -15,6 +16,7 @@ require (
github.com/go-openapi/validate v0.19.0 // indirect
github.com/go-sql-driver/mysql v1.4.1
github.com/go-swagger/go-swagger v0.19.0
github.com/go-swagger/scan-repo-boundary v0.0.0-20180623220736-973b3573c013 // indirect
github.com/gobuffalo/packd v0.0.0-20190315124812-a385830c7fc0 // indirect
github.com/gobuffalo/packr v1.24.0
github.com/gobwas/glob v0.2.3
Expand Down
Loading

0 comments on commit f964c69

Please sign in to comment.