README.md in cronitor-3.0.0 vs README.md in cronitor-3.1.0
- old
+ new
@@ -23,10 +23,35 @@
$ gem install cronitor
## Usage
+
+### Configure
+
+You need to set Cronitor Token in order to create a monitor
+
+#### Using configure
+
+```ruby
+require 'cronitor'
+
+Cronitor.configure do |cronitor|
+ cronitor.default_token = 'token' # default token to be re-used by cronitor
+end
+```
+
+#### Using ENV
+
+```
+# .env
+CRONITOR_TOKEN: token
+
+# bash
+export CRONITOR_TOKEN='token'
+```
+
### Creating a Monitor
A Cronitor monitor (hereafter referred to only as a monitor for brevity) is created if it does not already exist, and its ID returned.
Please see the [Cronitor Monitor API docs](https://cronitor.io/docs/monitor-api) for details of all the possible monitor options.
@@ -54,10 +79,10 @@
}
],
note: 'A human-friendly description of this monitor'
}
-# The token parameter is optional; if omittted, ENV['CRONITOR_TOKEN'] will be used
+# The token parameter is optional; if omittted, ENV['CRONITOR_TOKEN'] will be used if not configured
my_monitor = Cronitor.new token: 'api_token', opts: monitor_options
```
### Updating an existing monitor