Docker swarm uses the concept of secret files for sharing config secrets to services launched within a swarm.
I would ideally like to leverage this for passing database credentials and API keys to a service running in a swarm.
First attempt I tried this anon function defined at the top of my config/prod.exs
secret_file =
fn(file_path)->
if File.exists?(file_path) do
File.read!(file_path)
else
nil
end
end
I then used the following pattern to attempt setting config vars based on either secret files, or typical env vars passed to a release with REPLACE_OS_VARS=true