luminus-framework / luminus-framework/luminus-immutant

http server fails silently, likely stray host key in environment not caught by run-options

Open
#1 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
10
Forks
3
PR merge metrics
No merged PRs in 30d

Description

I have a number of older luminus apps that run fine, but this week I created a couple new ones with the latest framework (for which the generated code is different than in the older apps) and none of them ran, even with the simplest setup. No error message or other problem indication was given. I tracked it to http-server, which logged that it had started but was not working, and I got it to work by passing a map with explicit keys from env. I realized then that HOST was set in my environment (for various reasons and not as a server host) and this was getting passed unchanged through `luminus.http-server/run-options`, causing problems.

I realize that I can remove the HOST environment variable before running the server, but this seems less convenient and turn-key than I think luminus wants to be. Perhaps HOST could be treated like PATH
when luminus mounts the various components. For instance, the `:host` option to `http-server/start` could be changed to something like `:server-host` with `run-options` changed accordingly:

```
(defn run-options [opts]
(merge
{:host "0.0.0.0"}
(-> opts
;;options contain ENV path and possibly host
;;Immutant path is found at :handler-path
;;Server host is found at :server-host
(dissoc :path :contexts :host)
(rename-keys {:handler-path :path, :server-host :host})
(select-keys
(-> #'immutant/run meta :valid-options)))))
```

Just a thought. Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at luminus.http-server/run-options and follow how http-server/start passes options into immutant/run. Reproduce the failure with HOST set in the environment, then compare behavior with explicit server-host handling. Done means the server ignores the unrelated HOST environment value while preserving the intended handler path and host options; no test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.