-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MS-670] feat: Add license. Dynamic subject generation (#46)
* [MS-670] feat: Add license. Dynamic subject generation * [MS-670] docs: Update readme
- Loading branch information
1 parent
1a54d2e
commit 3d36c75
Showing
21 changed files
with
120 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright 2024, Mirumee Labs | ||
|
||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,25 +10,31 @@ | |
|
||
<div align="center"> | ||
<h1>Nimara Mailer</h1> | ||
<strong>TypeScript serverless app for sending emails from Saleor.</strong> | ||
<strong>TypeScript serverless app for sending emails from <a href="https://github.com/saleor/saleor">Saleor</a>. And more!</strong> | ||
</div> | ||
<br /> | ||
<br /> | ||
|
||
## Local development | ||
App designed to work in AWS cloud using lambda functions, SQS and secret manager. | ||
It has two main components: | ||
- [events-receiver](src/events-receiver.ts) - responsible for receiving events from Saleor (or custom ones via http) and pushing them to SQS queue. | ||
- [email-sender](src/emails-sender.ts) - responsible for receiving events from SQS queue via lambda triggers and sending emails. | ||
|
||
1. Setup required envs. You can copy `.env.example` to `.env` and adjust it. | ||
Upon build, it outputs two files. Each, for one component. Both share same environment variables. When deployed to lambda, specify the following handlers: | ||
- `events-receiver.handler` | ||
- `emails-sender.handler` | ||
|
||
When installing the app in Saleor, it will store it's configuration in the secret manager. Therfore, the secret should be created beforehand with empty object (`{}`) and the name should be specified in `SECRET_MANAGER_APP_CONFIG_PATH` env. | ||
|
||
``` | ||
SALEOR_URL=<e.g. https://your.eu.saleor.cloud> | ||
STATIC_URL=<where from emails static images will be served> | ||
SQS_QUEUE_URL= | ||
If you want to change supported events, you can do it in the [const](src/const.ts) file editing `SALEOR_EVENTS` or `CUSTOM_EVENTS` constants. | ||
|
||
AWS_ACCESS_KEY_ID= | ||
AWS_REGION= | ||
AWS_SECRET_ACCESS_KEY= | ||
SECRET_MANAGER_APP_CONFIG_PATH=<secret manager config name> | ||
``` | ||
When adding new events, remember to update [TEMPLATES_MAP](src/lib/emails/const.ts) constant with the proper template and extract email function. | ||
|
||
--- | ||
|
||
## Local development | ||
|
||
1. Setup required envs. You can copy `.env.example` to `.env` and adjust it. | ||
2. [`nvm use`](https://github.com/nvm-sh/nvm) - to set proper node version. | ||
3. [`pnpm install`](https://pnpm.io/installation) - to install dependencies. | ||
4. `pnpm dev` - to start the app. | ||
|
@@ -40,18 +46,6 @@ | |
Alternatively, you can use docker to run the app. | ||
|
||
1. Setup required envs. You can copy `.env.example` to `.env` and adjust it. | ||
|
||
``` | ||
SALEOR_URL=<e.g. https://your.eu.saleor.cloud> | ||
STATIC_URL=<where from emails static images will be served> | ||
SQS_QUEUE_URL= | ||
AWS_ACCESS_KEY_ID= | ||
AWS_REGION= | ||
AWS_SECRET_ACCESS_KEY= | ||
SECRET_MANAGER_APP_CONFIG_PATH=<secret manager config name> | ||
``` | ||
|
||
2. `docker compose build` - build the app. | ||
3. `docker compose run --rm --service-ports app` - run the app. | ||
|
||
|
@@ -229,3 +223,10 @@ or | |
``` | ||
$ pnpm test:watch | ||
``` | ||
|
||
<br> | ||
<div align="center"> <strong>Crafted with ❤️ by Mirumee Software</strong> | ||
|
||
[[email protected]](mailto:[email protected]) | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters