File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,9 +12,8 @@ async fn main() -> Result<()> {
1212 . json ( )
1313 . init ( ) ;
1414 let settings = envy:: from_env :: < Settings > ( ) ?;
15- let table_name = settings. table_name . expect ( "table name to be specified" ) ;
1615
17- let repository = Arc :: new ( DynamoDbRepository :: new ( table_name) . await ) ;
16+ let repository = Arc :: new ( DynamoDbRepository :: new ( settings . table_name ) . await ) ;
1817 let app = build_app ( repository) ?;
1918 poem_lambda:: run ( app) . await . expect ( "app to start correctly" ) ;
2019
Original file line number Diff line number Diff line change @@ -2,3 +2,4 @@ pub mod api;
22pub mod repository;
33
44mod error;
5+ pub mod settings;
Original file line number Diff line number Diff line change 1+ use serde:: Deserialize ;
2+
3+ #[ derive( Debug , Deserialize ) ]
4+ pub struct Settings {
5+ #[ serde( default ) ]
6+ pub table_name : String ,
7+ }
You can’t perform that action at this time.
0 commit comments