neuron v0.9.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
  • 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