Skip to content

Grifter Configuration

Robert Schultheis edited this page Mar 9, 2014 · 1 revision

What is configured

  • Required: Which service(s) the Grifter instance shall interact with
  • Optional: Which environment(s) (QA, Staging, Production) the service(s) exist in
  • Optional: Which faraday adapter to use
  • Optional: Which parameter encoding strategy to use (Flat or Nested)
  • Optional: Locations of grift files
  • Optional: Default headers for each service

Ways to configure grifter

There are two basic ways to configure Grifter:

  • Using a config file (most often named grifter.yml)
  • At the time the Grifter instance is instantiated, by passing in options

Config file

This is best show by example. The following grifter.yml contents use all supported configuration options:

---
services:
  myapi:
    url: 'http://myapi.com'

  myotherapi:
    hostname: 'myotherapi.com'
    ssl: false
    port: 4567

environments:
  dev:
    myapi:
      url: 'http://dev.myapi.com'

  staging:
    myapi:
      hostname: 'staging.myapi.com'
      port: 456
      ignore_ssl_cert: true

grift_globs:
  - 'my_special_grift_file_directory/**/*_grifts.rb'

Clone this wiki locally