This is the Scala version of the project bondi-go, which is a command-line script to read data from CSV file, get data from PostgreSQL database, then send emails using AWS SES client.
Topics:
- Scala 3
- Skunk: a functional PostgreSQL client for Scala.
- PureConfig: a Scala library for loading configuration files.
- PostgreSQL: a powerful, open source object-relational database system.
- cats: a library that provides abstractions for functional programming in Scala.
- cats-effect: a library that provides abstractions for effectful programming in Scala.
- circe: a JSON library for Scala.
How to run the application:
- changeAwsProfileToProd
- put the corresponding csv file in the
src/main/resourcesfolder, file name should bepif_club_transfer.csvordd_club_transfer.csv - run the application:
auto/prod io.daniel.apps.ClubTransfer PIForauto/prod io.daniel.apps.ClubTransfer DD - can test by changing #185 to
toDanielemail - if the input is JSON, then change to
version/json_inputbranch, use local script or (https://www.convertcsv.com/csv-to-json.htm) to convert csv to json (fobNumber must be a string)
Run:
auto/dev io.daniel.apps.ClubTransfer PIF
auto/dev io.daniel.apps.ClubTransfer DD
auto/prod io.daniel.apps.ClubTransfer PIF
auto/prod io.daniel.apps.ClubTransfer DDStart the local PostgreSQL database using Docker:
docker compose up- Setting the mainClass in
build.sbtCompile / mainClass := Some("io.daniel.Main") Compile / mainClass := Some("io.daniel.apps.RefundApp")
- Using the
runtask with the--mainoptionsbt "runMain io.daniel.apps.FixDuplicateEmails"
Secrets Manager can't find the specified secret. (Service: SecretsManager, Status Code: 400, Request ID: aab88d0e-ca3b-461a-8a6f-21371846fc63)
Options:
- Option 1: add environment variable
AWS_PROFILE=prodto Intellij Idea Run/Debug configuration. - Option 2: run on the command line:
AWS_PROFILE=prod auto/prod io.daniel.apps.ClubTransfer