dotnet / tye

Tye is a tool that makes developing, testing, and deploying microservices and distributed applications easier. Project Tye includes a local orchestrator to make developing microservices easier and the ability to deploy microservices to Kubernetes with minimal configuration.
MIT License
5.29k stars 520 forks source link

How to overwrite ASPNETCORE_ENVIRONMENT when running in Docker? #1476

Closed josdeweger closed 1 year ago

josdeweger commented 1 year ago

I have a bunch of appsetting json files for different environments, like for instance appsettings.local.json. I'm loading the environment specific file like this: config.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", optional: false, reloadOnChange: true);

In my yaml file I set

name: MyServices
services:
  - name: SomeApi
    project: SomeApi/SomeApi.csproj
    env:
      - name: ASPNETCORE_ENVIRONMENT
        value: "local"

When running tye run this is fine, but using --docker seems to overwrite the env variable with "Development". I can see this in the logs as wel, where I can see -e "ASPNETCORE_ENVIRONMENT=Development" being passed on container initialization.

How can I set ASPNETCORE_ENVIRONMENT to the value I want?

davidfowl commented 1 year ago

That seems like a bug

josdeweger commented 1 year ago

@davidfowl looks like it indeed. How can I help?

davidfowl commented 1 year ago

Send a pull request?

josdeweger commented 1 year ago

@davidfowl something like this https://github.com/dotnet/tye/pull/1480?