# Client library - need for global variable

**URL:** <https://forum.elixirforum.com/t/client-library-need-for-global-variable/1706>\
**Category:** Questions\
**Created:** [September 18, 2016, 2:41pm UTC](https://forum.elixirforum.com/t/client-library-need-for-global-variable/1706 "2016-09-18T14:41:27Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Srene](https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/s/e36b37/32.png) [@Srene](https://forum.elixirforum.com/u/Srene)\
**Post date:** [September 18, 2016, 2:41pm UTC](https://forum.elixirforum.com/t/client-library-need-for-global-variable/1706/1 "2016-09-18T14:41:27Z")

</div>

Hi…

I am creating a client library in which there is an authentication check - say →

```exs
defmodule Auth do
   def auth_key do
      "ABcd1234"
   end
end

defmodule Action do
   import Auth
   def func do 
      key = auth_key( )
      unless validate(key) do
            raise_error_message()
      end
  end
end

```

Now the issue is the auth\_key has to be set by the users of this library. In a OOP oriented language this is easy. I had a global variable for auth\_key and users of the library simply overwrite the default value of the variable. How can I do it in Elixir??

---

<div class="post-metadata">

**Author:** ![Linuus](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/linuus/32/1104_2.png) [@Linuus](https://forum.elixirforum.com/u/Linuus)\
**Post date:** [September 18, 2016, 2:51pm UTC](https://forum.elixirforum.com/t/client-library-need-for-global-variable/1706/2 "2016-09-18T14:51:53Z")

</div>

Is it a static value that the user of the library should configure? If so, you should use elixir’s/Mix config support.

[http://elixir-lang.org/docs/stable/mix/Mix.Config.html](http://elixir-lang.org/docs/stable/mix/Mix.Config.html)
