-
Notifications
You must be signed in to change notification settings - Fork 212
Create an InternalExpression type which allows precanned access to env.FIREBASE_CONFIG #1231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/params/types.ts
Outdated
* A CEL expression which represents an internal Firebase variable. This class | ||
* cannot be instantiated by developers, but we provide several canned instances | ||
* of it to make available params that will never have to be defined at | ||
* deployment time, and can always be read from process.env. | ||
*/ | ||
export class InternalExpression extends Expression<string> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it should be @internal and the variable should be declared as an Expression. Type erasure is great for hiding implementation details and not tying our hands to them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. Done.
Unfortunately the part you're trying not to do is the part I specifically want to do. I want people to be able to say:
That means you're going to need to support both a |
Hmmm... on second thought I can see how (for now) you can turn that into literal values in the CEL expression?... there may be less work than anticipated (e.g. not extending the parser) but the user journey is what I'm hoping for. |
It turns out that feature isn't difficult to support. Done. |
I think your magic transformation of FIREBASE_CONFIG to params.DEFAULT_BUCKET et. al. might be on the right track. The extensions team is looking at adding a bunch of new expressions, and I think I've negotiated that they will not be published as environment variables (since we'll use up the user's list). So I think we should strongly consider having a list of magic envs in the CLI that we have values for but don't write to .env files. Everything you've done here is a good candidate. |
Defines special Expressions that users can import from
firebase-functions/params
that pull a value out of process.env.FIREBASE_CONFIG, but are never prompted for. Pairs with firebase/firebase-tools#4970.