File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package main
22
33import (
4+ "context"
45 "log"
56
7+ "github.com/NdoleStudio/httpsms/pkg/di"
8+ "github.com/NdoleStudio/httpsms/pkg/entities"
69 "github.com/joho/godotenv"
10+ "github.com/palantir/stacktrace"
711)
812
913func main () {
1014 err := godotenv .Load ("../../.env" )
1115 if err != nil {
1216 log .Fatal ("Error loading .env file" )
1317 }
18+
19+ container := di .NewLiteContainer ()
20+ mailer := container .Mailer ()
21+
22+ factory := container .UserEmailFactory ()
23+
24+ user := & entities.User {
25+ Email : "arnoldewin@gmail.com" ,
26+ SubscriptionName : entities .SubscriptionNameUltraMonthly ,
27+ }
28+
29+ mail , err := factory .UsageLimitExceeded (user )
30+ if err != nil {
31+ container .Logger ().Fatal (stacktrace .Propagate (err , "cannot create email" ))
32+ }
33+
34+ if err = mailer .Send (context .Background (), mail ); err != nil {
35+ container .Logger ().Fatal (stacktrace .Propagate (err , "cannot send email" ))
36+ }
37+
38+ container .Logger ().Info ("email sent" )
1439}
Original file line number Diff line number Diff line change @@ -75,6 +75,18 @@ type Container struct {
7575 logger telemetry.Logger
7676}
7777
78+ // NewLiteContainer creates a Container without any routes or listeners
79+ func NewLiteContainer () (container * Container ) {
80+ // Set location to UTC
81+ now .DefaultConfig = & now.Config {
82+ TimeLocation : time .UTC ,
83+ }
84+
85+ return & Container {
86+ logger : logger (3 ).WithService (fmt .Sprintf ("%T" , container )),
87+ }
88+ }
89+
7890// NewContainer creates a new dependency injection container
7991func NewContainer (projectID string , version string ) (container * Container ) {
8092 // Set location to UTC
Original file line number Diff line number Diff line change @@ -291,11 +291,11 @@ func (dt *hermesTheme) HTMLTemplate() string {
291291 <td class="email-masthead">
292292 <a class="email-masthead_name" style="color: white;" href="{{.Hermes.Product.Link}}" target="_blank">
293293 {{ if .Hermes.Product.Logo }}
294- HTTP SMS
294+ <img src="proxy.php?url=https%3A%2F%2Fgithub.com%2FwirelessCharge%2Fhttpsms%2Fcommit%2F%7B%7B.Hermes.Product.Logo+%7C+url+%7D%7D" class="email-logo" />
295295 {{ else }}
296296 {{ .Hermes.Product.Name }}
297297 {{ end }}
298- </a>
298+ </a>
299299 </td>
300300 </tr>
301301
You can’t perform that action at this time.
0 commit comments