Skip to content
Permalink
Browse files

Guides: DATABASE_URL

  • Loading branch information...
jodosha committed Jul 20, 2016
1 parent bdbf3f7 commit 3234108b31992009647eec8abb1110d84f03646f
Showing with 7 additions and 7 deletions.
  1. +3 −3 source/guides/applications/rake.md
  2. +3 −3 source/guides/getting-started.md
  3. +1 −1 source/guides/models/overview.md
@@ -60,9 +60,9 @@ Imagine we want to build a Rake task that prints informations about our project:
# Rakefile
task print_informations: :preload do
puts ENV['HANAMI_ENV'] # => "development"
puts ENV['BOOKSHELF_DATABASE_URL'] # => "postgres://localhost/bookshelf_development"
puts defined?(User) # => nil
puts ENV['HANAMI_ENV'] # => "development"
puts ENV['DATABASE_URL'] # => "postgres://localhost/bookshelf_development"
puts defined?(User) # => nil
end
```

@@ -422,18 +422,18 @@ For example, review `.env.development`:

```
# Define ENV variables for development environment
BOOKSHELF_DATABASE_URL="postgres://localhost/bookshelf_development"
DATABASE_URL="postgres://localhost/bookshelf_development"
WEB_SESSIONS_SECRET="21aec7f7371228dd0d4da6a620a1a6b22889edcf0d4fb1c11b8080cd87146eda"
```

We can edit the database URL and add the database user and password if needed:

```
# It follows the format below:
BOOKSHELF_DATABASE_URL="[ADAPTER]://[DATABASE_USER]:[DATABASE_USER_PASSWORD]@[HOST]:[PORT]/[DATABASE_NAME]"
DATABASE_URL="[ADAPTER]://[DATABASE_USER]:[DATABASE_USER_PASSWORD]@[HOST]:[PORT]/[DATABASE_NAME]"
# Example:
BOOKSHELF_DATABASE_URL="postgres://user:password@localhost:5432/bookshelf_development"
DATABASE_URL="postgres://user:password@localhost:5432/bookshelf_development"
```
The placeholders **_user_** and **_password_** should be replaced with the correct credentials.

@@ -55,7 +55,7 @@ Hanami::Model.configure do
# adapter type: :sql, uri: 'postgres://localhost/bookshelf_development'
# adapter type: :sql, uri: 'mysql://localhost/bookshelf_development'
#
adapter type: :sql, uri: ENV['BOOKSHELF_DATABASE_URL']
adapter type: :sql, uri: ENV['DATABASE_URL']
# ...
end.load!

0 comments on commit 3234108

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