firebase / firebase/firebase-functions
Feature Request - Add consumeAppCheckToken and CORS in setGlobalOptions
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 232
- Avg merge
- 20h 46m
- Merged PRs (30d)
- 15
Description
I am proposing an enhancement for the `setGlobalOptions` function in Firebase Functions Gen 2.
The `setGlobalOptions` function enables setting global configurations for the entire project such as `enforceAppCheck`. For example:
```TypeScript
import { setGlobalOptions } from "firebase-functions/v2";
setGlobalOptions({
enforceAppCheck: true,
});
```
But I think it would be beneficial to include `consumeAppCheckToken` and `cors` options as well.
Adding `consumeAppCheckToken` will allow developers to fully handle AppCheck at a global level, complementing `enforceAppCheck` which is already available. Details on `consumeAppCheckToken` which is currently set at the function level can be found [here](https://firebase.google.com/docs/app-check/cloud-functions#replay-protection).
And including `cors` will provide developers the convenience of managing Cross-Origin Resource Sharing settings across the entire project. Details on `cors` which is currently set at the function level can be found [here](https://firebase.google.com/docs/functions/callable?gen=2nd#cors).
These enhancements will reduce repetitive individual function configurations, significantly streamlining the development process.
The end result would be something like this:
```TypeScript
import { setGlobalOptions } from "firebase-functions/v2";
setGlobalOptions({
enforceAppCheck: true,
consumeAppCheckToken: true,
cors: [/firebase\.com$/, "flutter.com"]
});
```
Thank you for your consideration.
Contributor guide
Assessment
This issue has not been assessed yet.