-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce Environment variables #432
Comments
We could make DOTNET_RUNNING_IN_CONTAINER imply DOTNET_USE_POLLING_FILE_WATCHER, but not ASPNETCORE_URLS. Users may have configured their endpoints differently, for example |
@natemcmaster - I would think you could make DOTNET_RUNNING_IN_CONTAINER imply both. There would have to be an override mechanism however (e.g. any explicit variables would need to override "implied" variables). That aside, the implied logic is a drawback of sorts as it does complicate things - implementation and documentation. |
Just to make sure this is known, there are other ways to determine if running in a container (see https://github.com/dotnet/cli/blob/master/src/dotnet/Telemetry/DockerContainerDetectorForTelemetry). The main reason I like DOTNET_RUNNING_IN_CONTAINER is because it is platform agnostic in addition to being easy to check for. |
How would dotnet-watch tell the different between an implied and explicit variable? I can't think of a way to make implied vs explicit values for ASPNETCORE_URLS work with dotnet-watch and dotnet-run. |
Isn't it something like this: HarvestEnvironmentVariables();
if (DOTNET_RUNNING_IN_CONTAINER && ASPNETCORE_URLS == "")
{
ASPNETCORE_URLS = "http://+:80";
} I think about 443 this way:
|
DOTNET_RUNNING_IN_CONTAINER +1 The Dockerfiles should have an EXPOSE directive to document what port gets used, and imo, it makes sense to set ASPNETCORE_URLS in the Dockerfile to make clear it matches the exposed port. On the topic of secure by default: it is common to have http only in containers. See this issue on how ASP.NET Core default template fails when deployed on a container platform: aspnet/Templating#404 |
@richlander so, my thinking on this hasn't changed. We still need ASPNETCORE_URLS to be defined separately for usage outside of dotnet-watch. If you want to condense DOTNET_USE_POLLING_FILE_WATCHER and DOTNET_RUNNING_IN_CONTAINER, I can make the two-line change to dotnet-watch to support polling when DOTNET_RUNNING_IN_CONTAINER is set. |
Good on DOTNET_USE_POLLING_FILE_WATCHER and DOTNET_RUNNING_IN_CONTAINER. Filed aspnet/DotNetTools#415 for that. I'll see if @davidfowl is wiling to take a change in aspnet/Hosting to make running in containers easier. Thoughts @glennc? |
What's the change to hosting? |
@davidfowl I don't know where the 'fix' should be. It's about aspnet/Templating#404, aspnet/BasicMiddleware#315 |
We're not going to make this change. The EVs in the Dockerfiles are fine as-is. |
@richlander you are not adding 'DOTNET_RUNNING_IN_CONTAINER'?
|
Seems funny after #426.
I got to thinking ... with
DOTNET_RUNNING_IN_CONTAINER
in place, can we provide different defaults fordotnet watch
and for Kestrel?Would be excellent if the defaults made
DOTNET_USE_POLLING_FILE_WATCHER
andASPNETCORE_URLS=http://+:80
unnecessary when running in containers, whenDOTNET_RUNNING_IN_CONTAINER
was set to true??? Shouldn't that be the case?/cc @natemcmaster @MichaelSimons @glennc
The text was updated successfully, but these errors were encountered: