dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.66k stars 1.06k forks source link

environment variables with DOTNET_CONTAINER_ or DOTNET_SDK_CONTAINER_ prefix #41609

Closed kasperk81 closed 2 months ago

kasperk81 commented 3 months ago

i see that it's an existing pattern in containers that a generic SDK_ prefix is used instead of DOTNETCONTAINER or DOTNET_SDKCONTAINER which is a better namespace prefix.

  1. The Twelve-Factor App Methodology

https://12factor.net/config A litmus test for whether an app has all config it needs in env vars is whether the codebase could be made open source at any moment, without compromising any credentials. Using namespaced prefixes like MYAPP_ helps prevent collisions and makes it clear which app an environment variable pertains to.

  1. Heroku's Best Practices for Config Vars

https://devcenter.heroku.com/articles/config-vars Use a common prefix for related variables to group them logically. For example, if your app’s name is 'MYAPP', then a good practice is to prefix your variables with 'MYAPP_' to avoid collisions with other applications and to make it clear which application a variable pertains to.

  1. AWS Lambda Environment Variables Best Practices

https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html To avoid naming conflicts, use a consistent naming convention, such as APPNAME_VARIABLE, where APPNAME is the name of your application or service.

  1. Kubernetes Configuration Best Practices

https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/ Use descriptive variable names and consider namespacing them with your application or organization name to avoid conflicts and to maintain clarity.

  1. Google Cloud Environment Variables Best Practices

https://cloud.google.com/functions/docs/configuring/env-var Prefix your environment variables with the service name or application name to prevent collisions and to organize them clearly, such as SERVICE_NAME_VARIABLE_NAME.

baronfel commented 3 months ago

Strongly agree here - we should update the SDK environment variables and documentation to use the DOTNET_CONTAINER prefix instead of the existing names.