Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ and this project adheres to [Break Versioning](https://www.taoensso.com/break-ve

- Print clearer errors when Postgres CLI commands fail. (@mddelk in #437)
- Print clear errors from `hanami db` commands for unsupported database URL schemes and for database URLs that cannot be parsed, rather than raising a `RuntimeError` or `URI::InvalidURIError`. Neither error includes the URL, since it may contain credentials. (@parndt in #463)
- In the `config/puma.rb`, generated by `hanami new`, listen on localhost only in development, so the dev server isn't reachable from other machines on your network. Set `HANAMI_HOST` to listen on another address, such as `0.0.0.0` inside a container. Existing apps can copy the change into their own `config/puma.rb`. (@parndt in #479)
- Ignore SQLite's `-wal`, `-shm` and `-journal` files in the `.gitignore` generated by `hanami new`, by widening `db/*.sqlite` to `db/*.sqlite*`. (@cllns in #451)
- When the app's `config.code_reloading` is enabled, `reload` in `hanami console` will reload the app in place, preserving your local session. Otherwise, the console restarts as before. (@afomera and @timriley in #444)
- Use Dry CLI 2.0 (@timriley)
Expand Down
12 changes: 9 additions & 3 deletions lib/hanami/cli/generators/gem/app/puma.erb
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# frozen_string_literal: true

#
# Environment and port
# Environment, host, and port
#
port ENV.fetch("<%= Hanami::Port::ENV_VAR %>", <%= Hanami::Port::DEFAULT %>)
environment ENV.fetch("HANAMI_ENV", "development")
hanami_env = ENV["HANAMI_ENV"] || ENV["APP_ENV"] || ENV["RACK_ENV"] || "development"
environment hanami_env

# In development, listen on localhost only, so the server isn't reachable from other machines on
# your network. Set HANAMI_HOST to listen on another address, such as 0.0.0.0 inside a container.
host = ENV["HANAMI_HOST"] unless ENV["HANAMI_HOST"].to_s.empty?
host ||= "localhost" if hanami_env == "development"
port ENV.fetch("<%= Hanami::Port::ENV_VAR %>", <%= Hanami::Port::DEFAULT %>), host

#
# Threads within each Puma/Ruby process (aka worker)
Expand Down
24 changes: 18 additions & 6 deletions spec/unit/hanami/cli/commands/gem/new_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,16 @@ class Routes < Hanami::Routes
# frozen_string_literal: true

#
# Environment and port
# Environment, host, and port
#
port ENV.fetch("HANAMI_PORT", 2300)
environment ENV.fetch("HANAMI_ENV", "development")
hanami_env = ENV["HANAMI_ENV"] || ENV["APP_ENV"] || ENV["RACK_ENV"] || "development"
environment hanami_env

# In development, listen on localhost only, so the server isn't reachable from other machines on
# your network. Set HANAMI_HOST to listen on another address, such as 0.0.0.0 inside a container.
host = ENV["HANAMI_HOST"] unless ENV["HANAMI_HOST"].to_s.empty?
host ||= "localhost" if hanami_env == "development"
port ENV.fetch("HANAMI_PORT", 2300), host

#
# Threads within each Puma/Ruby process (aka worker)
Expand Down Expand Up @@ -1070,10 +1076,16 @@ class Routes < Hanami::Routes
# frozen_string_literal: true

#
# Environment and port
# Environment, host, and port
#
port ENV.fetch("HANAMI_PORT", 2300)
environment ENV.fetch("HANAMI_ENV", "development")
hanami_env = ENV["HANAMI_ENV"] || ENV["APP_ENV"] || ENV["RACK_ENV"] || "development"
environment hanami_env

# In development, listen on localhost only, so the server isn't reachable from other machines on
# your network. Set HANAMI_HOST to listen on another address, such as 0.0.0.0 inside a container.
host = ENV["HANAMI_HOST"] unless ENV["HANAMI_HOST"].to_s.empty?
host ||= "localhost" if hanami_env == "development"
port ENV.fetch("HANAMI_PORT", 2300), host

#
# Threads within each Puma/Ruby process (aka worker)
Expand Down
Loading