Open davidfowl opened 2 months ago
@vhvb1989 @ellismg - does azd
support default values in the manifest as above? Or do we need to log an issue in azd to get this support?
- public static IResourceBuilder
AddParameter(this IDistribuedApplicationBuilder builder, string value, bool secret = false); - public static IResourceBuilder
AddParameter(this IDistribuedApplicationBuilder builder, Func<Task > valueGetter, bool secret = false); - public static IResourceBuilder
AddParameter(this IDistribuedApplicationBuilder builder, Func valueGetter, bool secret = false);
string name
parameter?value
=> defaultValue
? public static IResourceBuilder<ParameterResource> AddParameter(this IDistribuedApplicationBuilder builder, string name, string defaultValue, bool secret = false);
public static IResourceBuilder<ParameterResource> AddParameter(this IDistribuedApplicationBuilder builder, string name, Func<Task<string>> defaultValueGetter, bool secret = false);
public static IResourceBuilder<ParameterResource> AddParameter(this IDistribuedApplicationBuilder builder, string name, Func<string> defaultValueGetter, bool secret = false);
Parameters:<name>
? Which wins? The value in code, or the value in the configuration?Don't we need a string name parameter?
Done.
Should value => defaultValue?
Done.
What happens if I have a configuration value with the name Parameters:
? Which wins? The value in code, or the value in the configuration?
Code wins.
Code wins.
Hmmm 🤔, maybe it shouldn't be named defaultValue
then...
@davidfowl we need to make it so that the callback is async I think.
Yes we do, but that's a huge change. @eerhardt attempted did that initially and backed it out. Time to go again 😄
Moved this to backlog. We should make the case for pulling it in to 8.2. My thinking here is that right now people can do things like leverage the config system to allow injecting these values and the config system is extensible. A lot of this is just surfacing API at the main method level.
I’m working on Hashicorp Vault integration and need something similar. In my scenario Vault is initialized after the container is created and there’s values I need to persist for future runs like unseal keys and root token that aren’t possible to know before the container is initialized. The current user secrets setup only allows for generated values as well and prevents me from being able to provide the value to be persisted so I’m unclear how to proceed and could use some assistance. It seems like a new ParameterDefault type and extension method in ParameterResourceExtensions may be necessary, but I also don’t really understand how this is expected to work when deployed.
@los93sol do you have a repo where you are working on this somewhere.
I'm curious about what you are are saying about values you can't know before the container is initialized. Presently we don't have a mechanism for extracting data from the container (unless the hosting extension calls an API on the container process itself).
So this may not necessarily be the droid you are looking for in that case. But I'd like to know more to better understand the challenge you have.
@davidebbo can you look at this one?
Background and Motivation
There are scenarios 2 scenarios that aren't supported well:
Parameters:name
).Proposed API
Usage Examples
Default user name
Manifest changes
PublishDefaultValue
requires a manifest schema change:Risks
Low