Acces Config Vars in Heroku with dotnet core to get the database URL Acces Config Vars in Heroku with dotnet core to get the database URL heroku heroku

Acces Config Vars in Heroku with dotnet core to get the database URL


Heroku config vars are exposed to your application as environment variables:

Config vars are exposed to your app's code as environment variables. For example, in Node.js you can access your app's DATABASE_URL config var with process.env.DATABASE_URL.

In C# you should be able to use System.Environment.GetEnvironmentVariable to read them, e.g.

Environment.GetEnvironmentVariable("DATABASE_URL")