Skip to content
This repository was archived by the owner on Jun 3, 2023. It is now read-only.

Commit

Permalink
Use ported gen-feed Lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
mlafeldt committed Aug 30, 2021
1 parent 683697a commit 2f3d327
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ node_modules:
yarn install

build: rust
@GOFLAGS=-trimpath $(GOX) -os=linux -arch=amd64 -ldflags=-s -output="bin/{{.Dir}}/handler" ./gen-feed
# @GOFLAGS=-trimpath $(GOX) -os=linux -arch=amd64 -ldflags=-s -output="bin/{{.Dir}}/handler" ./gen-feed

lint:
# go vet ./...
Expand Down
5 changes: 3 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ export class DilbertFeedStack extends cdk.Stack {
const genFeed = new lambda.Function(this, 'GenFeedFunc', {
functionName: `${id}-gen-feed`,
code: lambda.Code.fromAsset('bin/gen-feed'),
handler: 'handler',
runtime: lambda.Runtime.GO_1_X,
handler: 'bootstrap',
runtime: lambda.Runtime.PROVIDED_AL2,
memorySize: 128,
timeout: cdk.Duration.seconds(10),
logRetention: logs.RetentionDays.ONE_MONTH,
environment: {
BUCKET_NAME: bucket.bucketName,
STRIPS_DIR: stripsDir,
FEED_PATH: feedPath,
RUST_LOG: 'info',
},
})
bucket.grantReadWrite(genFeed)
Expand Down
6 changes: 2 additions & 4 deletions src/bin/gen-feed/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use aws_sdk_s3::{ByteStream, Client};
use chrono::Utc;
use lambda_runtime::{Context, Error};
use lambda_runtime::{handler_fn, Context, Error};
use log::info;
use serde::{Deserialize, Serialize};
use serde_json::json;
use std::env;

mod feed;
Expand All @@ -20,8 +19,7 @@ struct Output {
#[tokio::main]
async fn main() -> Result<(), Error> {
simple_logger::init_with_env()?;
// lambda_runtime::run(handler_fn(handler)).await?;
info!("{}", json!(handler(Input {}, Context::default()).await?));
lambda_runtime::run(handler_fn(handler)).await?;
Ok(())
}

Expand Down

0 comments on commit 2f3d327

Please sign in to comment.