erlang-systemd
erlang-systemd copied to clipboard
Support for loading credentials from $CREDENTIALS_DIRECTORY
This feature would make it easier to support the workflow around LoadCredentials and friends as described here: https://systemd.io/CREDENTIALS/
That makes sense and it should be quite simple to add.
For reference, I have something like the following in my utils file:
defp path_from_credentials_dir(name) do
if credentials_directory = System.get_env("CREDENTIALS_DIRECTORY") do
path =
Path.join(credentials_directory, name)
if File.regular?(path) do
path
else
nil
end
else
nil
end
end
It's not much and it's not a big problem to have that in my own code, but this package seems like a natural place for it to live.
It looks interesting, however I would remove the second check in the body. So it would return paths even to non-existent credentials.