Skip to content
This repository has been archived by the owner on Nov 14, 2019. It is now read-only.

Limit size of the upload to 10MB #118

Merged
merged 4 commits into from
Aug 5, 2019
Merged

Conversation

antho1404
Copy link
Member

@antho1404 antho1404 commented Jul 26, 2019

fix https://github.com/mesg-foundation/cli/issues/110

This limits the size of the upload to 10MB avoiding to publish services that are too big and will consume a lot of bandwidth and space.

10MB is a totally arbitrary value but I'm open to change this value based on your feedback

@antho1404 antho1404 added the enhancement New feature or request label Jul 26, 2019
@antho1404 antho1404 added this to the next milestone Jul 26, 2019
@antho1404 antho1404 self-assigned this Jul 26, 2019
Copy link
Member

@NicolasMahe NicolasMahe left a comment

Choose a reason for hiding this comment

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

The size should be calculated by taking into account the .mesgignore content. Otherwise it could for example get the size of a node_modules folder that is actually excluded in the .mesgignore.
Also, I suggest to move this logic in the createTar function in deployer.ts file:

export const createTar = (path: string): Readable => {
const mesgignore = join(path, '.mesgignore')
const ig = ignore().add([
'.git',
...(existsSync(mesgignore) ? readFileSync(mesgignore).toString().split('\n') : [])
])
return tar.create({

@antho1404
Copy link
Member Author

The library did not allow this kind of configuration and I could not find any other library. I end up recreating this logic of getting the size, it's not that complicated. Now the filter is applied when fetching the size

@NicolasMahe NicolasMahe merged commit 17fe2ec into master Aug 5, 2019
@NicolasMahe NicolasMahe deleted the feature/limit-upload-size branch August 5, 2019 12:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No option for limit deploy request size.
2 participants