[Feature]: Change secret env variables to use pydantic `Secret` generic typing
Contact Details
No response
What should we build?
pydantic Secret generic type masks the property value immediately and makes the value only available with .get_secret_value().
This would make the masking specifically for exposing the env variables unnecessary since they are masked from the start and makes less likely for something to accidentally not be masked unless not typed with Secret[{type}].
https://docs.pydantic.dev/2.8/examples/secrets/#serialize-secretstr-and-secretbytes-as-plain-text
Do you mean to use Secret also for variables like CACHE_URI i.e. as Secret[RedisDsn]?
I'm not sure if we considered this for #964 but I don't quite remember - @Igoranze do you recall?
It would make it a breaking change because people will need to add .get_secret_value() in their code that uses core settings