oauth icon indicating copy to clipboard operation
oauth copied to clipboard

loadFromEnvironment

Open wilzbach opened this issue 8 years ago • 1 comments

I use something like this instead of loadConfig in settings.d. This isn't something complex, hence I opened this issue to see whether this would be interesting for others.

auto loadFromEnvironment(
    string providerName,
    string envPrefix,
    string redirectUri,
)
{
    import std.process : environment;
    string clientId = environment[envPrefix ~ "_CLIENTID"];
    string clientSecret = environment[envPrefix ~ "_CLIENTSECRET"];

    return new immutable(OAuthSettings)(
        providerName,
        clientId,
        clientSecret,
        redirectUri);
}

wilzbach avatar Jun 03 '17 23:06 wilzbach

Yes, a requirement for certain deployments.

MartinNowak avatar Jan 02 '18 21:01 MartinNowak