README.md in fmrest-0.2.3 vs README.md in fmrest-0.2.4

- old
+ new

@@ -61,10 +61,46 @@ ``` For each request fmrest-ruby will first request a session token (using the provided username and password) if it doesn't yet have one in store. +## Connection settings + +In addition to the required `:host`, `:database`, `:username` and `:password` +connection options, you can also pass `:ssl` and `:proxy`, which are passed to +the underlying [Faraday](https://github.com/lostisland/faraday) connection. + +You can use this to, for instance, disable SSL verification: + +```ruby +FmRest::V1.build_connection( + host: "example.com", + ... + ssl: { verify: false } +) +``` + +You can use the `:log` option for basic request logging, see the section on +[Logging](#Logging) below. + +### Default connection settings + +If you're only connecting to a single FM database you can configure it globally +through `FmRest.default_connection_settings=`. E.g.: + +```ruby +FmRest.default_connection_settings = { + host: "example.com", + database: "database name", + username: "username", + password: "password" +} +``` + +This configuration will be used by default by `FmRest::V1.build_connection` as +well as your models whenever you don't pass a configuration hash explicitly. + ## Session token store By default fmrest-ruby will use a memory-based store for the session tokens. This is generally good enough for development, but not good enough for production, as in-memory tokens aren't shared across threads/processes. @@ -554,15 +590,15 @@ If using fmrest-ruby + Spyke in a Rails app pretty log output will be set up for you automatically by Spyke (see [their README](https://github.com/balvig/spyke#log-output)). You can also enable simple STDOUT logging (useful for debugging) by passing -`log: true` in the options hash for either `FmRest.config=` or your models' -`fmrest_config=`, e.g.: +`log: true` in the options hash for either +`FmRest.default_connection_settings=` or your models' `fmrest_config=`, e.g.: ```ruby -FmRest.config = { +FmRest.default_connection_settings = { host: "example.com", database: "My Database", username: "z3r0c00l", password: "abc123", log: true @@ -577,11 +613,9 @@ password: "...", log: true } end ``` - -Note that the log option set in `FmRest.config` is ignored by models. If you need to set up more complex logging for your models can use the `faraday` block inside your class to inject your own logger middleware into the Faraday connection, e.g.: