mweagle / Sparta

go microservices, powered by AWS Lambda
https://gosparta.io
MIT License
717 stars 48 forks source link

Add option to bundle static files in the zip archive #21

Closed ryanwalls closed 8 years ago

ryanwalls commented 8 years ago

I'm looking for a way to configure my lambda functions dynamically. In other apps I use spf13/viper to load local config files. Because in Sparta we create a binary that doesn't include the config files, this doesn't work.

Ideally I'd like to be able to tell Sparta that I want some files included in the zip file and unpacked along with my binary. That way I could load them in the traditional way. (Perhaps this could piggyback on the existing functionality for zipping up static S3 websites?)

mweagle commented 8 years ago

HI Ryan, Can you use the new archive hook for this?

ryanwalls commented 8 years ago

@mweagle Perhaps you know the answer to this... if I include a file in the zip, what is the path from which to load it from in my lambda function?

ryanwalls commented 8 years ago

Perhaps here? $LAMBDA_TASK_ROOT?

ryanwalls commented 8 years ago

Thanks. The archive hook will work. Haven't implemented yet, but the example is straight forward. Closing this.

mweagle commented 8 years ago

Before I closed this I was doing some local testing to confirm that it actually did what it was supposed to. I was running into some ZIP corruption issue that I think I resolved with the upcoming 0.9.1 - LMK if you encounter any problems with the existing release.