Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

GetOrSetSecret

Method
📦 Aspire.Hosting v17.0.0
func (UserSecretsManager) GetOrSetSecret(
resourceBuilder Resource,
name string,
value string,
) error

Signature

methodGetOrSetSecret
Gets a secret value if it exists in configuration, or sets it to the provided value if it does not.
GetOrSetSecret(
resourceBuilder Resource,
name string,
value string,
) error
resourceBuilderResourceA resource builder from the target application.
namestringThe secret name.
valuestringThe value to persist when the secret is missing.
error

Returns error.

Applies to

This method applies to the following types: