-
Notifications
You must be signed in to change notification settings - Fork 930
Add useEmulator() to Storage #4346
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
🦋 Changeset detectedLatest commit: ed28cf6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Size Analysis Report |
Binary Size ReportAffected SDKs
Test Logs |
4f740a3
to
b6e0ffd
Compare
export function makeUrl(urlPart: string): string { | ||
return `https://${DEFAULT_HOST}/v0${urlPart}`; | ||
export function makeUrl(urlPart: string, host: string): string { | ||
const protocolMatch = host.match(/^(\w+):\/\/.+/); |
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.
Added this because emulator uses http when production use defaults to https. Seems cleaner to let the host string contain a protocol or not, and if so, parse it in this one function, than to store protocol as a separate property on StorageService and get it everywhere service.host is also used.
Changeset File Check ✅
|
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.
Is this safe to merge now?
export function makeUrl(urlPart: string): string { | ||
return `https://${DEFAULT_HOST}/v0${urlPart}`; | ||
export function makeUrl(urlPart: string, host: string): string { | ||
const protocolMatch = host.match(/^(\w+):\/\/.+/); |
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.
nit/optional, I think using replace with callback would save some lines and be more readable
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.
I couldn't figure out how to easily set up a regex that would call the callback if the protocol wasn't there so I left it alone for now. We can always optimize any time so let me know if you have a snippet you want to put in.
@hsubox76 is this available for use yet? From the docs it seems we need to download/reference |
It's merged and should go out in the release next Thursday. |
Thanks! |
Is this feature actually ready for firebase developers? I ask because as of v9.10.0 the firebase-tools CLI still does not include storage in the list of emulators that can be initialised. |
@vbeffa thank you! |
Add
storage().useEmulator()
to current storage package anduseStorageEmulator()
to storage-exp.Wait for emulator to be available before merging.