diff --git a/README.md b/README.md index 93628a1..1e44343 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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"})`. diff --git a/build.boot b/build.boot index 6236251..f576f2f 100644 --- a/build.boot +++ b/build.boot @@ -1,5 +1,5 @@ (def project 'framework-one) -(def version "0.5.1") +(def version "0.5.2") (task-options! pom {:project project diff --git a/src/framework/one.clj b/src/framework/one.clj index 70c3868..9faf02f 100644 --- a/src/framework/one.clj +++ b/src/framework/one.clj @@ -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))]