ASP.NET core includes built-in support for environment variables as a configuration provider.
All the details are available here: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-3.1
Docker-compose simply sets the environment variables in the container, so this works just the same as using environment variables with dotnet core without using docker…
Now, I haven’t seen app.config used for dotnet core, so maybe that’s your problem, I thought it was a dotnet framework thing… Usually in dotnet core config is taken from appsettings.json, and overridden using environment variables.
From code you can use dependency injection to get access the values through
public class MyClass
private readonly IConfiguration _config:
public MyClass(IConfiguration config) => _config = config;
var apiUrl = _config["API_ENDPOINT"];