From 7f8229cad0ef2ee088b1a0ccffe6cee5d176d275 Mon Sep 17 00:00:00 2001 From: Sonoko Mizuki Date: Thu, 20 Apr 2023 12:11:49 +0900 Subject: [PATCH 1/3] Update email.go --- email/email.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/email/email.go b/email/email.go index 8f78ddd..223be6b 100644 --- a/email/email.go +++ b/email/email.go @@ -92,9 +92,13 @@ func Send_email(recipient string, subject string, htmlBody string, textBody stri aws_ses_id := db.Get_setting("AWS_SES_ID") aws_ses_secret := db.Get_setting("AWS_SES_SECRET") sender := db.Get_setting("AWS_SES_EMAIL_FROM") + region := db.Get_setting("AWS_REGION") + if region == "" { + region = "us-east-1" + } sess, err := session.NewSession(&aws.Config{ - Region: aws.String("us-east-1"), + Region: aws.String(region), Credentials: credentials.NewStaticCredentials(aws_ses_id, aws_ses_secret, ""), }) From 294a4eb054b60f245f41cdf78b32754ace13fa68 Mon Sep 17 00:00:00 2001 From: Sonoko Mizuki Date: Thu, 20 Apr 2023 12:12:06 +0900 Subject: [PATCH 2/3] Udpate setting.sql and docs --- docs/INSTALL.md | 1 + docs/SETTINGS.md | 1 + sql/settings.sql | 1 + 3 files changed, 3 insertions(+) diff --git a/docs/INSTALL.md b/docs/INSTALL.md index faca21e..ea4bed2 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -106,6 +106,7 @@ add email notifications for payments and fund receipt `AWS_SES_ID=..."` (settings table) `AWS_SES_SECRET=..."` (settings table) `AWS_SES_EMAIL_FROM=..."` (settings table) +`AWS_REGION=...` (settings table) `FUNCTION_EMAIL=ENABLE"` (settings table) `cards.email_address='card.notifications@yourdomain.com'` `cards.email_enable='Y'` diff --git a/docs/SETTINGS.md b/docs/SETTINGS.md index e42df0b..72fe502 100644 --- a/docs/SETTINGS.md +++ b/docs/SETTINGS.md @@ -26,6 +26,7 @@ Here are the descriptions of values available to use in the `settings` table: | AWS_SES_ID | | Amazon Web Services - Simple Email Service - access id | | AWS_SES_SECRET | | Amazon Web Services - Simple Email Service - access secret | | AWS_SES_EMAIL_FROM | | Amazon Web Services - Simple Email Service - email from field | +| AWS_REGION | | Amazon Web Services - Account region | | EMAIL_MAX_TXS | | maximum number of transactions to include in the email body | | FUNCTION_LNDHUB | DISABLE | system level switch for using LNDHUB in place of LND | | LNDHUB_URL | | URL for the LNDHUB service | diff --git a/sql/settings.sql b/sql/settings.sql index 75b7dd1..53f2aaa 100644 --- a/sql/settings.sql +++ b/sql/settings.sql @@ -23,6 +23,7 @@ INSERT INTO settings (name, value) VALUES ('FUNCTION_EMAIL', ''); INSERT INTO settings (name, value) VALUES ('AWS_SES_ID', ''); INSERT INTO settings (name, value) VALUES ('AWS_SES_SECRET', ''); INSERT INTO settings (name, value) VALUES ('AWS_SES_EMAIL_FROM', ''); +INSERT INTO settings (name, value) VALUES ('AWS_REGION', ''); INSERT INTO settings (name, value) VALUES ('EMAIL_MAX_TXS', ''); INSERT INTO settings (name, value) VALUES ('FUNCTION_LNDHUB', ''); INSERT INTO settings (name, value) VALUES ('LNDHUB_URL', ''); From d3439db85b70c6432ffd07b08e8889c2dbd36313 Mon Sep 17 00:00:00 2001 From: Sonoko Mizuki Date: Sat, 22 Apr 2023 16:27:45 +0900 Subject: [PATCH 3/3] Set defualt value of AWS_REGION --- docs/SETTINGS.md | 2 +- email/email.go | 3 --- sql/settings.sql | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/docs/SETTINGS.md b/docs/SETTINGS.md index 72fe502..d3909a9 100644 --- a/docs/SETTINGS.md +++ b/docs/SETTINGS.md @@ -26,7 +26,7 @@ Here are the descriptions of values available to use in the `settings` table: | AWS_SES_ID | | Amazon Web Services - Simple Email Service - access id | | AWS_SES_SECRET | | Amazon Web Services - Simple Email Service - access secret | | AWS_SES_EMAIL_FROM | | Amazon Web Services - Simple Email Service - email from field | -| AWS_REGION | | Amazon Web Services - Account region | +| AWS_REGION | us-east-1 | Amazon Web Services - Account region | | EMAIL_MAX_TXS | | maximum number of transactions to include in the email body | | FUNCTION_LNDHUB | DISABLE | system level switch for using LNDHUB in place of LND | | LNDHUB_URL | | URL for the LNDHUB service | diff --git a/email/email.go b/email/email.go index 223be6b..7b56a88 100644 --- a/email/email.go +++ b/email/email.go @@ -93,9 +93,6 @@ func Send_email(recipient string, subject string, htmlBody string, textBody stri aws_ses_secret := db.Get_setting("AWS_SES_SECRET") sender := db.Get_setting("AWS_SES_EMAIL_FROM") region := db.Get_setting("AWS_REGION") - if region == "" { - region = "us-east-1" - } sess, err := session.NewSession(&aws.Config{ Region: aws.String(region), diff --git a/sql/settings.sql b/sql/settings.sql index 53f2aaa..730ac0e 100644 --- a/sql/settings.sql +++ b/sql/settings.sql @@ -23,7 +23,7 @@ INSERT INTO settings (name, value) VALUES ('FUNCTION_EMAIL', ''); INSERT INTO settings (name, value) VALUES ('AWS_SES_ID', ''); INSERT INTO settings (name, value) VALUES ('AWS_SES_SECRET', ''); INSERT INTO settings (name, value) VALUES ('AWS_SES_EMAIL_FROM', ''); -INSERT INTO settings (name, value) VALUES ('AWS_REGION', ''); +INSERT INTO settings (name, value) VALUES ('AWS_REGION', 'us-east-1'); INSERT INTO settings (name, value) VALUES ('EMAIL_MAX_TXS', ''); INSERT INTO settings (name, value) VALUES ('FUNCTION_LNDHUB', ''); INSERT INTO settings (name, value) VALUES ('LNDHUB_URL', '');