-
Notifications
You must be signed in to change notification settings - Fork 22
Configuration
Dan Ryan edited this page Jun 13, 2012
·
21 revisions
Spice has the following configuration variables:
-
Spice.server_url
- The URL of the Chef server. Remember to include the port if you are hosting your own Chef server. Default:http://localhost:4000
-
Spice.chef_version
- The version of the Chef server. Setting this changes functionality, so make sure the numbers match (especially major versions). Default: "0.10.10" -
Spice.client_name
- The client name to connect as. This client must be an admin. Default: "" -
Spice.client_key
- The client key (an OpenSSL::PKey::RSA object). Default: "" -
Spice.user_agent
- The user agent that Spice will use. Default: "SpiceSpice::VERSION
" Spice.connection_options # A hash of options to provide to the Faraday HTTP connection. # Default: {} Spice.middleware # The Faraday middleware stack. # Default:
Proc.new do |builder|
builder.use Spice::Response::ParseJSON
builder.use Spice::Response::ClientError
builder.adapter Faraday.default_adapter
end
To connect to a Chef server at https://chef.example.com:5000 with the "admin" API client, throw this somewhere your app can initialize:
Spice.server_url = "http://chef.example.com:5000"
Spice.client_name = "admin"
Spice.client_key = "/path/to/keyfile.pem"
Say you had a Chef server v0.10.8 running locally on port 4000 over HTTP, you only need to set your client_name
and client_key
path:
Spice.client_name = "admin"
Spice.client_key = "/path/to/keyfile.pem"
You can also use the Spice.setup block if you prefer this style:
Spice.setup do |s|
s.server_url = "http://chef.example.com:4000"
s.client_name = "admin"
s.client_key = "/path/to/keyfile.pem"
s.chef_version = "0.9.18"
end
If you want to reset your config to their default values:
Spice.reset