neuron v0.8.0 Neuron.Config

This module can be used to modify your graphql client configuration either globaly or for the current process.

Summary

Functions

gets configuration value for Neuron

sets global configuration values for Neuron

sets global/process configuration values for Neuron

Functions

get(config)
get(config :: atom) :: any

gets configuration value for Neuron

Examples

iex>Neuron.Config.set(url: "http://example.com/graph")
iex>Neuron.Config.get(:url)
"http://example.com/graph"

iex>Neuron.Config.set(headers: [name: "value"])
iex>Neuron.Config.get(:headers)
[name: "value"]

iex>Neuron.Config.get(:invalid)
nil
set(value)
set(value :: keyword) :: :ok

sets global configuration values for Neuron

Examples

iex> Neuron.Config.set(url: "http://example.com/graph")
:ok
set(context, value)
set(context :: :global | :process, value :: keyword) :: :ok

sets global/process configuration values for Neuron

Available options are:

  • url: graphql endpoint url
  • headers: headers to be sent in the request
  • connection_opts: additional options to be passed to HTTPoison
  • as_json: sends requests as json instead of graphql format (e.g Github API v4 only accepts json)

Examples

iex> Neuron.Config.set(headers: ["name": "val"])
:ok

iex> Neuron.Config.set(:process, url: "http://example.com/graph")
:ok