reddec / trusted-cgi

Lightweight runner for lambda functions/apps in CGI like mode
https://trusted-cgi.reddec.net
MIT License
218 stars 16 forks source link

Directories in templates #2

Closed biozz closed 3 years ago

biozz commented 3 years ago

I am using latest docker image of trusted-cgi and was not able to create a lambda from Nim template with an error saying:

Error: -30000: create lambda: write file src/lambda.nim content: open /data/b37de1ee-1e86-4209-b817-7ecb321d696f/src/lambda.nim: no such file or directory

Nim template is the only one that has directory in the template definition - src/lambda.nim. So I then went through the sources and discovered, that files are created with WriteFile:

https://github.com/reddec/trusted-cgi/blob/31a0a060d0ee3dcf2274286aa0fcc443667995e4/application/lambda/initializer.go#L56

But WriteFile can't handle directories. It should be possible to parse file path and do something like MkdirAll with it. What do you think?

PS: I am not a Nim developer and have just discovered trusted-cgi a couple of days ago; you have done an amazing job, thank you for that simple and straightforward solution!

reddec commented 3 years ago

Thanks for the feedback! I checked - seems like a bug (some files are missed). Will fix. Sorry for inconvenience

reddec commented 3 years ago

fixed in v0.3.6