Skip to content

Conversation

@laurenzlong
Copy link
Contributor

Description

Use FIREBASE_PROJECT and CLOUD_RUNTIME_CONFIG during population of function.config(), in anticipating of these env variables being available in the runtime in the future.

Code sample

@laurenzlong
Copy link
Contributor Author

laurenzlong commented May 9, 2017

Must use with this branch of the CLI to see functions and config emulation in action: firebase/firebase-tools#328

src/config.ts Outdated
} catch (e) {
try {
loaded = require('../../../config.json');
loadedFromFile = require('../../../config.json');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused confusion with @samtstern's functions and was meant to be alpha behavior. Should we cut this or give a deprecation notice?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cut it.

it('throws an error if Firebase configs not present', () => {
mockRequire('../../../.runtimeconfig.json', {});
expect(config).to.throw('Firebase config variables are missing.');
expect(config).to.throw('Firebase config variables are not available.');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We added more complex behaviors. Could we test them? Hint: I'm pretty sure I see a bug =p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants