-
Notifications
You must be signed in to change notification settings - Fork 4
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
[#170333527] Service logo upload function #10
Conversation
Affected stories
New dependencies added: @types/lolexAuthor: Unknown Description: TypeScript definitions for lolex Homepage: http://npmjs.com/package/@types/lolex
|
Created | about 5 years ago |
Last Updated | 7 days ago |
License | BSD-3-Clause |
Maintainers | 4 |
Releases | 44 |
Direct Dependencies | @sinonjs/commons |
Generated by 🚫 dangerJS
Codecov Report
@@ Coverage Diff @@
## master #10 +/- ##
==========================================
- Coverage 86.5% 85.44% -1.07%
==========================================
Files 7 8 +1
Lines 126 158 +32
Branches 8 10 +2
==========================================
+ Hits 109 135 +26
- Misses 17 23 +6
Continue to review full report at Codecov.
|
} | ||
|
||
// tslint:disable-next-line:no-object-mutation | ||
context.bindings.logo = Buffer.from(logoPayload.logo, "base64"); |
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.
can Buffer.from()
fail ?
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.
it looks like you have to wrap it around a tryCatch() block:
https://nodejs.org/api/buffer.html#buffer_class_method_buffer_from_array
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.
It shouldn't be necessary, because according to the documentation a TypeError will be thrown if logoPayload.logo
is not an appropriate type, but its type is already checked and validated by the LogoPayload middleware inside the middlewaresWrap.
UploadServiceLogo/handler.ts
Outdated
>; | ||
|
||
export function UpdateServiceLogoHandler( | ||
_GCTC: CustomTelemetryClientFactory, |
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.
it looks like the telemetryclient is unused
UploadServiceLogo/index.ts
Outdated
const cosmosDbUri = getRequiredStringEnv("CUSTOMCONNSTR_COSMOSDB_URI"); | ||
const cosmosDbKey = getRequiredStringEnv("CUSTOMCONNSTR_COSMOSDB_KEY"); | ||
const cosmosDbName = getRequiredStringEnv("COSMOSDB_NAME"); | ||
const logosHost = getRequiredStringEnv("LOGOS_HOST"); |
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.
const logosHost = getRequiredStringEnv("LOGOS_HOST"); | |
const logosHost = getRequiredStringEnv("SERVICE_LOGOS_HOST"); |
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.
we must document this variable and the logos storage connection string into the readme (I know that it is empty atm)
} | ||
|
||
export default httpStart; | ||
import { Context } from "@azure/functions"; |
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.
it looks like these files differs only for newlines, may you revert 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.
I'm sorry, I tried to revert, but I couldn't manage. 😕
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.
can you try removing the file and checkin it out again ? (or copyingit from another clone)
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 tried to copy it from another clone, also changing the core.autocrlf
git setting for the project, but I couldn't manage to revert the line endings anyway... 😕
} | ||
|
||
export default httpStart; | ||
import { Context } from "@azure/functions"; |
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.
can you try removing the file and checkin it out again ? (or copyingit from another clone)
README.md
Outdated
| Variable name | Description | type | | ||
| -------------------------------------- | --------------------------------------------------------------------------------- | ------- | | ||
| SERVICE_LOGOS_HOST | The host name of the service logos storage | string | | ||
| StorageConnection | The connectiong string used to connect to Azure Storage services | 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.
is this is for the services logs I'd use a more explicit name as 'LogosStorageConnection'
UploadServiceLogo/handler.ts
Outdated
|
||
return ResponseSuccessRedirectToResource( | ||
{}, | ||
`${logosHost}/services/${serviceId}.png`, |
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.
naming: if this embeds https prefix then it's logosUrl (not an hostname), same states for the name of the environment variable
This PR aims to add a new function to upload the logo of an existing service.