Coder Social home page Coder Social logo

izhilenkov / sendgrid-mock Goto Github PK

View Code? Open in Web Editor NEW

This project forked from janjaali/sendgrid-mock

0.0 0.0 0.0 1.95 MB

SendGrid-Mock serves as a simple server mocking the sendgrid-apis for development purposes.

Home Page: https://cloud.docker.com/repository/docker/ghashange/sendgrid-mock/general

License: MIT License

Shell 2.10% JavaScript 93.07% HTML 1.78% Dockerfile 3.05%

sendgrid-mock's Introduction

SendGrid-Mock

SendGrid-Mock serves as a simple server mocking the sendgrid-apis for development purposes.

./assets/screenshot_1.8.0.png

Functionalities

HTTP API

  • Send mails POST /v3/mail/send

  • Retrieve sent mails GET /api/mails

    • Filter capabilities are included and can be combined:
      • To: GET /api/[email protected]
      • Subject:
        • GET /api/mails?subject=The subject (exact match)
        • GET /api/mails?subject=%subject% (contains)
      • Datetime: GET /api/mails?dateTimeSince=2020-12-06T10:00:00Z (ISO-8601 format)
  • Delete sent mails DELETE /api/mails

    • Filter capabilities are included and can be combined:

UI

  • Retrieve sent mails and display them
  • Delete sent mails

Extras

  • Basic authentication support: Add basic authentication credentials by specifying environment variable AUTHENTICATION to the following format: user1:passwordForUser1;user2:passwordForUser2

  • Request rate limiting: Both the actual SendGrid API server as well as the SSL server can be rate limited by specifying environment variables:

    • RATE_LIMIT_ENABLED: true or false (default)
    • RATE_LIMIT_WINDOW_IN_MS: The time window in milliseconds (default: 60000)
    • RATE_LIMIT_MAX_REQUESTS: The maximum number of requests allowed in the time window (default: 100)
    • SSL_RATE_LIMIT_ENABLED: true or false (default)
    • SSL_RATE_LIMIT_WINDOW_IN_MS: The time window in milliseconds (default: 60000)
    • SSL_RATE_LIMIT_MAX_REQUESTS: The maximum number of requests allowed in the time window (default: 100)
  • By default, all emails older than 24 hours will be deleted. This can be configured using environment variable MAIL_HISTORY_DURATION which uses ISO-8601 Duration format such as 'PT24H'.

Dockerized

The SendGrid-Mock server and the UI are both contained in the same docker-image which you can pull from Docker Hub and start it via:

docker run -it -p 3000:3000 -e "API_KEY=sendgrid-api-key" ghashange/sendgrid-mock:1.9.2

Some prepared HTTP calls can be found here.

The UI can be accessed at http://localhost:3000.

SSL support

SendGrid-Mock also supports SSL using Let's Encrypt. To enable SSL, run it as follows:

docker run -it -p 3000:3000 -e "API_KEY=sendgrid-api-key" -e "CERT_DOMAINNAMES=[your-domain-name]" -e "CERT_EMAIL=[your-email-address]" ghashange/sendgrid-mock:1.9.2

Development

Setup with npm ci and start both server and UI concurrently with npm run dev. Per default the server is reachable via http://localhost:3000 and the UI via http://localhost:1234.

Some prepared HTTP calls can be found here.

The UI can be accessed at http://localhost:3000.

Build

Create docker image with docker build -t ghashange/sendgrid-mock:1.9.2 ..

Release

  1. Update version number in package.json, version file and README

  2. Create PR against master branch

  3. Merge PR

  4. Create GitHub release and update Docker Hub description

sendgrid-mock's People

Contributors

janjaali avatar rdehuyss avatar dependabot[bot] avatar alexjamesbrown avatar sn1perdog avatar tylermadsen-xup avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.