\\n \\n
Which would result in:
\\n<img src=\\"/files/picture.png?v=9fhe73kaf3\\"/>\\n
\\nWhere 9fhe73kaf3
is the randomly-generated cache-buster.
An email client was added as a Service to the Container
but it is just a skeleton without any actual email-sending functionality. The reason is because there are a lot of ways to send email and most prefer using a SaaS solution for that. That makes it difficult to provide a generic solution that will work for most applications.
The structure in the client (MailClient
) makes composing emails very easy and you have the option to construct the body using either a simple string or with a template by leveraging the template renderer. The standard library can be used if you wish to send email via SMTP and most SaaS providers have a Go package that can be used if you choose to go that direction. You must finish the implementation of MailClient.send
.
The from address will default to the configuration value at Config.Mail.FromAddress
. This can be overridden per-email by calling From()
on the email and passing in the desired address.
See below for examples on how to use the client to compose emails.
\\nSending with a string body:
\\nerr = c.Mail.\\n Compose().\\n To(\\"hello@example.com\\").\\n Subject(\\"Welcome!\\").\\n Body(\\"Thank you for registering.\\").\\n Send(ctx)\\n
\\nSending with a template body:
\\nerr = c.Mail.\\n Compose().\\n To(\\"hello@example.com\\").\\n Subject(\\"Welcome!\\").\\n Template(\\"welcome\\").\\n TemplateData(templateData).\\n Send(ctx)\\n
\\nThis will use the template located at templates/emails/welcome.gohtml
and pass templateData
to it.
By default, the application will not use HTTPS but it can be enabled easily. Just alter the following configuration:
\\nConfig.HTTP.TLS.Enabled
: true
Config.HTTP.TLS.Certificate
: Full path to the certificate fileConfig.HTTP.TLS.Key
: Full path to the key fileTo use Let\'s Encrypt follow this guide.
\\nBy default, the Echo logger is not used for the following reasons:
\\nThe provided implementation uses the relatively new log/slog library which was added to Go in version 1.21 but swapping that out for whichever you prefer is very easy.
\\nThe simple pkg/log
package provides the ability to set and get a logger from the Echo context. This is especially useful when you use the provided logger middleware (see below). If you intend to use a different logger, modify these methods to receive and return the logger of your choice.
Adding a logger to the context:
\\nlogger := slog.New(logHandler).With(\\"id\\", requestId)\\nlog.Set(ctx, logger)\\n
\\nAccess and use the logger:
\\nfunc (h *handler) Page(ctx echo.Context) error {\\n log.Ctx(ctx).Info(\\"send a message to the log\\",\\n \\"value_one\\", valueOne,\\n \\"value_two\\", valueTwo,\\n )\\n}\\n
\\nWhen the Container configuration is initialized (initConfig()
), the slog
default log level is set based on the environment. INFO
is used for production and DEBUG
for everything else.
The SetLogger()
middleware has been added to the router which sets an initialized logger on the request context. It\'s recommended that this remains after Echo\'s RequestID()
middleware because it will add the request ID to the logger which means that all logs produced for that given request will contain the same ID, so they can be linked together. If you want to include more attributes on all request logs, set those fields here.
The LogRequest()
middleware is a replacement for Echo\'s Logger()
middleware which produces a log of every request made, but uses our logger rather than Echo\'s.
2024/06/15 09:07:11 INFO GET /contact request_id=gNblvugTKcyLnBYPMPTwMPEqDOioVLKp ip=::1 host=localhost:8000 referer=\\"\\" status=200 bytes_in=0 bytes_out=5925 latency=107.527803ms\\n
\\nFuture work includes but is not limited to:
\\nThank you to all of the following amazing projects for making this possible.
\\nOpen source data anonymization and synthetic data orchestration for developers. Create high fidelity synthetic data and sync it across your environments.
\\n \\n \\n
Open Source Data Anonymization and Synthetic Data Orchestration
\\n\\n \\n
Neosync is an open-source, developer-first way to anonymize PII, generate synthetic data and sync environments for better testing, debugging and developer experience.
\\nCompanies use Neosync to:
\\nNeosync is a fully dockerized setup which makes it easy to get up and running.
\\nA compose.yml file at the root contains production image refs that allow you to get up and running with just a few commands without having to build anything on your system.
\\nNeosync uses the newer docker compose
command, so be sure to have that installed on your machine.
To start Neosync, clone the repo into a local directory, be sure to have docker installed and running, and then run:
\\nmake compose/up\\n
\\nTo stop, run:
\\nmake compose/down\\n
\\nNeosync will now be available on http://localhost:3000.
\\nThe production compose pre-seeds with connections and jobs to get you started! Simply run the generate and sync job to watch Neosync in action!
\\nFor more in-depth details on environment variables, Kubernetes deployments, and a production-ready guide, check out the Deploy Neosync section of our Docs.
\\nSome resources to help you along the way:
\\nWe love contributions big and small. Here are just a few ways that you can contribute to Neosync.
\\nWe strongly believe in free and open source software and make this repo is available under the MIT expat license.
","description":"Open source data anonymization and synthetic data orchestration for developers. Create high fidelity synthetic data and sync it across your environments. Open Source Data Anonymization and Synthetic Data Orchestration\\n\\n| Website | Docs | Discord…","guid":"https://github.com/nucleuscloud/neosync","author":null,"authorUrl":null,"authorAvatar":null,"publishedAt":"2024-09-24T03:36:11.785Z","media":[{"url":"https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true","type":"photo","width":467,"height":195},{"url":"https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=shields","type":"photo","width":90,"height":20},{"url":"https://img.shields.io/github/license/lightdash/lightdash","type":"photo","width":78,"height":20},{"url":"https://github.com/nucleuscloud/neosync/actions/workflows/go.yml/badge.svg?sanitize=true","type":"photo","width":86,"height":20},{"url":"https://img.shields.io/twitter/follow/neosynccloud?label=Follow","type":"photo","width":63,"height":20},{"url":"https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/neosync","type":"photo","width":153,"height":20}],"categories":null,"attachments":null,"extra":null,"language":null},{"title":"testcontainers/testcontainers-go","url":"https://github.com/testcontainers/testcontainers-go","content":"Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.
Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean up those resources when the test is done.
\\nYou can find more information about Testcontainers for Go at golang.testcontainers.org, which is rendered from the ./docs directory.
\\nPlease visit the quickstart guide to understand how to add the dependency to your Go project.
","description":"Testcontainers for Go is a Go package that makes it simple to create and clean up container-based dependencies for automated integration/smoke tests. The clean, easy-to-use API enables developers to programmatically define containers that should be run as part of a test and clean…","guid":"https://github.com/testcontainers/testcontainers-go","author":null,"authorUrl":null,"authorAvatar":null,"publishedAt":"2024-10-24T02:50:09.982Z","media":[{"url":"https://github.com/testcontainers/testcontainers-go/actions/workflows/ci.yml/badge.svg?branch=main","type":"photo","width":150,"height":20,"blurhash":"UO8ZI|l_TWgx*GmtbrknNYnToykBlPd^kUkU"},{"url":"https://pkg.go.dev/badge/github.com/testcontainers/testcontainers-go.svg?sanitize=true","type":"photo","width":90,"height":20,"blurhash":"UE8~{1@q*^xtyss8nhj[4TSeozRjO]i^nhay"},{"url":"https://goreportcard.com/badge/github.com/testcontainers/testcontainers-go","type":"photo","width":88,"height":20,"blurhash":"UFBOf#z7P]k9.jiRXfkB9YRQtQoyt~m[o_kB"},{"url":"https://sonarcloud.io/api/project_badges/measure?project=testcontainers_testcontainers-go&metric=alert_status","type":"photo","width":148,"height":20,"blurhash":"UJ9u$9*ZJ|TU.jvoW,XNIoa$ozkCu0m[XObt"},{"url":"https://img.shields.io/badge/license-MIT-blue","type":"photo"},{"url":"https://github.com/codespaces/badge.svg?sanitize=true","type":"photo","width":150,"height":20},{"url":"https://img.shields.io/badge/Slack-4A154B?logo=slack","type":"photo","width":57,"height":20,"blurhash":"UAC$EB~qofRQ?0xuj[WB00D%ogbFeYV[jbof"}],"categories":null,"attachments":null,"extra":null,"language":null}],"readCount":10000,"subscriptionCount":10}')