neuron v4.0.0 Neuron.Config View Source

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

Link to this section Summary

Functions

gets configuration value for Neuron

sets global configuration values for Neuron

sets global/process configuration values for Neuron

Link to this section Functions

Link to this function

get(config)

View Source
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
Link to this function

set(value)

View Source
set(value :: keyword()) :: :ok

sets global configuration values for Neuron

Examples

iex> Neuron.Config.set(url: "http://example.com/graph")
:ok
Link to this function

set(context, value)

View Source
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
  • json_library: JSON library. Default is Jason.
  • parse_options: options to be passed to the JSON library when decoding JSON

Examples

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

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

iex> Neuron.Config.set(json_library: Jason)
:ok

iex> Neuron.Config.set(parse_options: [keys: :atoms])
:ok