mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-24 02:27:19 +00:00
47 lines
1.0 KiB
Plaintext
47 lines
1.0 KiB
Plaintext
title: $:/plugins/tiddlywiki/aws/lambda
|
|
|
|
! Template
|
|
|
|
The template [[$:/plugins/tiddlywiki/aws/lambdas/main]] transcludes everything required to render a TiddlyWiki as an AWS Lambda function.
|
|
|
|
The Lambda is build with this command:
|
|
|
|
```
|
|
tiddlywiki editions/aws --rendertiddler $:/plugins/tiddlywiki/aws/lambdas/main index.js text/plain
|
|
```
|
|
|
|
Or:
|
|
|
|
```
|
|
tiddlywiki editions/aws --build lambda
|
|
```
|
|
|
|
! Execution
|
|
|
|
The Lambda boot code looks for an array of tiddlers to load in `event.tiddlers`, and an array of commands to execute in `event.commands`. For example:
|
|
|
|
```
|
|
{
|
|
"commands": [
|
|
"--aws","s3-rendertiddler","HelloThere","eu-west-2","my-bucket-name","rendered.html"
|
|
],
|
|
"tiddlers": [
|
|
{
|
|
"title": "HelloThere",
|
|
"text": "Hello from {{Platform}}."
|
|
},
|
|
{
|
|
"title": "Platform",
|
|
"text": "TiddlyWiki"
|
|
}
|
|
]
|
|
}
|
|
|
|
```
|
|
|
|
! Return data
|
|
|
|
If the Lambda function successfully executes it returns an object with the following fields:
|
|
|
|
* ''lambda-result'': An array of `{bucketname,key}` pairs for each file written to S3 within the lambda function
|