Skip to content

Commit

Permalink
Release 0.5.2 with multiple ways to call start.
Browse files Browse the repository at this point in the history
  • Loading branch information
seancorfield committed Mar 22, 2016
1 parent ac30309 commit 8228131
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ You can specify a different port like this:

PORT=8111 boot run

In your main namespace -- `main.clj` in the example here -- the call to `(fw1/start)` can be passed an arbitrary number of configuration parameters:
In your main namespace -- `main.clj` in the example here -- the call to `(fw1/start)` can be passed configuration parameters either
as a map or as an arbitrary number of inline key / value pairs:

* `:after` - a function (taking / returning `rc`) which will be called after invoking any controller
* `:application-key` - the namespace prefix for the application, default none.
Expand All @@ -111,3 +112,4 @@ In your main namespace -- `main.clj` in the example here -- the call to `(fw1/st
* `:suffix` - the file extension used for views and layouts. Default is `"html"`.

For example: `(fw1/start :default-section "hello" :default-item "world")` will tell FW/1 to use `hello.world` as the default action.
You could also say: `(fw1/start {:default-section "hello" :default-item "world"})`.
2 changes: 1 addition & 1 deletion build.boot
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(def project 'framework-one)
(def version "0.5.1")
(def version "0.5.2")

(task-options!
pom {:project project
Expand Down
10 changes: 8 additions & 2 deletions src/framework/one.clj
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,14 @@
:suffix "html" ; views / layouts would be .html
:version "0.4.0"})

(defn start [& app-config]
(let [options (merge default-options (apply hash-map app-config))
(defn start
"Start the server. Accepts either a map of configuration parameters
or inline config key / value pairs (for backward compatibility)."
[& app-config]
(let [app-config (if (keyword? (first app-config))
(apply hash-map app-config)
(first app-config))
options (merge default-options app-config)
dynamic-options (framework-defaults options)
config (update-in dynamic-options [:middleware]
(merge-middleware dynamic-options))]
Expand Down

0 comments on commit 8228131

Please sign in to comment.