Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

Configuration

lusis edited this page Jan 24, 2011 · 2 revisions

Configuration

A configuration entry is a distinct atom of information about an application. A configuration MUST be tied to single Application entry. Configuration items work similar to a key/value system. Configuration items also require a format. Noah will attempt to use the format to set the mime-type when serving the content via the HTTP API.

  • Name string, unique
  • Body string, the value of the configuration item
  • Format string, user-defined entry describing the format of the body contents (i.e. json)
  • Application ID - integer, The ID of the Application to which this configuration entry belongs

Creating a new Configuration

via curl

You can see the draft API specifications for each object type here: Draft Configuration API

`curl -d '{"format":"string","data":"somevalue"}' -X PUT https://localhost:9292/c/myapplication/mysetting`

`{"result":"success","id":"1"}`

irb via Ohm models

You can use the irbstub.rb file to load the models (irb -r ./irbstub.rb)

>> a = Application[1]
=> #<Application:1 created_at="2011-01-24 05:35:00 UTC" updated_at="2011-01-24 05:35:43 UTC" name="myapplication">
>> c = Configuration.create(:name => "myother_setting", :format => "json", :body => "{\"some\":\"value\"}", :application => a)
=> #<Configuration:2 created_at="2011-01-24 05:40:11 UTC" updated_at="2011-01-24 05:40:11 UTC" name="myother_setting" format="json" body="{\"some\":\"value\"}" application_id=1>
>> c.valid?
=> true
>> c.save
=> #<Configuration:2 created_at="2011-01-24 05:40:11 UTC" updated_at="2011-01-24 05:40:16 UTC" name="myother_setting" format="json" body="{\"some\":\"value\"}" application_id=1>
>> Configurations.all
=> [#<Configuration:1 created_at="2011-01-24 05:35:43 UTC" updated_at="2011-01-24 05:35:43 UTC" name="mysetting" format="string" body="somevalue" application_id="1">, #<Configuration:2 created_at="2011-01-24 05:40:11 UTC" updated_at="2011-01-24 05:40:16 UTC" name="myother_setting" format="json" body="{\"some\":\"value\"}" application_id="1">]
Clone this wiki locally