defineSecret function
Creates a secret parameter that reads from Cloud Secret Manager.
Secret values are stored in Cloud Secret Manager and are only available
at runtime, not during deployment. You must bind secrets to functions
via the secrets option.
Example:
final apiKey = defineSecret('API_KEY');
firebase.https.onRequest(
name: 'secure',
options: HttpsOptions(secrets: [apiKey]),
(request) async {
final key = apiKey.value();
return Response.ok('Using API key');
},
);
Implementation
SecretParam defineSecret(String name) {
final param = SecretParam(name, null);
_registerParam(param);
return param;
}