Creating a Universal Settings File - Best Practice

defmodule Settings do

import Credentials

	def minimum do
		500
	end
 
	def account do
		Credentials.account_private_key
	end

	def exclude do
		['9wrQeUVUPE7cL12tYESEdeNbNqa535ftc7qNqTPXjqNv', '2tR9EKvDPMThfrFSb96CSBGYNwNPtzwkGcdhQjv4dVoj']
	end

	
end

Is this the best way to create a settings file for use by multiple modules in an app?

1 Like

Hi Maxximiliann :wave:

Can’t tell what your requirements are but couldn’t you achieve the same by using Mix.Config? Every module in the app can then read from this config :slight_smile:

1 Like

Hi dino!

Thanks so much for your help.

(Btw, Mix.Config has been deprecated with Config recommended in its stead.)

3 Likes

Thanks for sharing, was not aware that this was changing in Elixir 1.10 :slight_smile:

2 Likes

This is a change in Elixir 1.9 btw.

3 Likes