CloudflareStorage

CloudflareStorage is a simple gem for interacting with the Cloudflare Workers KV Storage from a Rails application.

It was designed to let you get started with minimal configuration.

Installation

Add this line to your application's Gemfile:

gem 'cloudflare_storage'

And then run:

bundle

Or install it yourself:

gem install cloudflare_storage 

Usage

Configure credentials with an initializer. For example:

# config/initializers/cloudflare_storage.rb
CloudflareStorage.configure do |config|
    config.account_id = Rails.application.credentials.cloudflare.account_id
    config.namespace_id = Rails.application.credentials.cloudflare.namespace_id
    config.token = Rails.application.credentials.cloudflare.token
  end
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, then create a new git tag and push it. Github actions will take care of the rest.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/geetotes/cloudflare_storage.

License

The gem is available as open source under the terms of the MIT License.

Alternatives

There are other gems out there that encompass the whole of the Cloudflare API. You should look to those if you're planning on using more than just Workers KV storage in your project.