Just reference a different config file on the command line.
>You don't want your config or keys to depend on an OS,or a language.
A path to a config file isn't an OS or language. The ini format is pretty widely supported.
>Finally Env variables can be restricted to a set of users,so third party process started with a different one cant access them.
This is exactly what filesystem permissions do for files already.
BEGIN {
$API = new Backend($ENV{credentials});
delete $ENV{credentials};
};
Filesystem permissions do not make it possible for a program to internally partition access to those credentials unless you (a) start it as root, or (b) delete the credentials file after reading it.Either of that seems to be able to be read straight from argv[0] of the process, so don't forget about cleaning that up.
Particularly this allows you to package a general configuration file, a user can provide an external configuration file and can for a specific instance even overwrite that with env (or command line arguments).
[1] http://docs.spring.io/spring-boot/docs/current/reference/htm...
ENV variables are not restricted by user though, your process can spawn another process under a different user and give it the same environment. It's the nature of the environment that it is usually inherited from the parent which causes the issues when we're talking about secrets.
Env makes things really flexible.For instance,you can call a program with env variables directly thus overriding the default ones,which simplify configuring applications. You dont have to have a test set-up,a production-setup or a staging set-up,just start a server or an app with different env variables in the command line.
You don't want your config or keys to depend on an OS,or a language. Finally Env variables can be restricted to a set of users,so third party process started with a different one cant access them.
I believe env variables are better than other solutions.