Skip to content

Commit

Permalink
Merge pull request #207 from bfabio/postgres
Browse files Browse the repository at this point in the history
fix(backward comp): use postgres as default db
  • Loading branch information
bfabio committed Aug 23, 2023
2 parents 39841aa + 23b5a6c commit 7a11205
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ The application will automatically reload when a change is made.

You can configure the API with environment variables:

* `DATABASE_DSN`: the data source used to connect to the database,
fe `host=db user=postgres password=postgres dbname=postgres port=5432`.
* `DATABASE_DSN`: the URI used to connect to the database,
fe `postgres://user:password@host:5432/dbname`.
Supports PostgreSQL and SQLite.

* `PASETO_KEY` (optional): Base64 encoded 32 bytes key used to check the
Expand Down
2 changes: 1 addition & 1 deletion internal/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func NewDatabase(connection string) (*gorm.DB, error) {
log.Println("using SQLite database")

database, err = gorm.Open(sqlite.Open(connection), &gorm.Config{TranslateError: true})
case strings.HasPrefix(connection, "postgres:"):
default:
log.Println("using Postgres database")

database, err = gorm.Open(postgres.Open(connection), &gorm.Config{
Expand Down

0 comments on commit 7a11205

Please sign in to comment.