Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Latest commit

 

History

History
47 lines (32 loc) · 1.15 KB

README.md

File metadata and controls

47 lines (32 loc) · 1.15 KB

Chef Datamapper Adapter

This is an experimental adapter for datamapper to use chef databags as a backend datastore.

Setup

There are three configuration options needed when you initialize the adapter.

DataMapper.setup(:default,
  :adapter => 'chef',
  :node_name => 'mybox',                       #this needs to also match a client client
  :client_key => '/path/to/client/key.pem',    #this key ,ust match the client from above
  :chef_server_url => 'http://localhost:4000/' #url to the chef server api
)

Models

Models do not need a serial nor do they need to have keys set. This is all taken care of by the adapter with a single added line.

class Post
  include DataMapper::Resource

  property :title, String
  property :body, Text

  has n, :comments

  is :chef  #the secret sauce

end

DISCLAIMER

This code is experimental and has not been fully tested. Use at your own risk.

License

The code and documentation is distributed under the Apache 2 license (http://www.apache.org/licenses/LICENSE-2.0.html). Contributions back to the source are encouraged.