Skip to content
Permalink
Browse files

docs: Fix environment variable DATABASE_URL to DSN (#1343)

Signed-off-by: Shota Sawada <xiootas@gmail.com>
  • Loading branch information...
sawadashota authored and aeneasr committed Apr 4, 2019
1 parent 367e94c commit f964c69f07a14d8ff71367e97071cb0207f62734
Showing with 78 additions and 4 deletions.
  1. +1 −1 README.md
  2. +1 −1 cmd/cli/handler_migrate.go
  3. +1 −1 cmd/migrate_sql.go
  4. +1 −1 cmd/server/handler.go
  5. +2 −0 go.mod
  6. +72 −0 go.sum
@@ -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**
@@ -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
}
@@ -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 ###
@@ -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".`)
}
}

2 go.mod
@@ -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
@@ -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

0 comments on commit f964c69

Please sign in to comment.
You can’t perform that action at this time.