Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions apps/auth/internal/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@ package app

import (
"context"
"github.com/kloudlite/api/apps/auth/internal/entities"

"github.com/99designs/gqlgen/graphql"
"github.com/gofiber/fiber/v2"
"github.com/kloudlite/api/pkg/nats"
"go.uber.org/fx"
"google.golang.org/grpc"

"github.com/kloudlite/api/apps/auth/internal/app/graph"
"github.com/kloudlite/api/apps/auth/internal/app/graph/generated"
"github.com/kloudlite/api/apps/auth/internal/domain"
"github.com/kloudlite/api/apps/auth/internal/entities"
"github.com/kloudlite/api/apps/auth/internal/env"
"github.com/kloudlite/api/common"
"github.com/kloudlite/api/constants"
"github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/auth"
"github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/comms"
httpServer "github.com/kloudlite/api/pkg/http-server"
"github.com/kloudlite/api/pkg/kv"
"github.com/kloudlite/api/pkg/nats"
"github.com/kloudlite/api/pkg/repos"
"go.uber.org/fx"
"google.golang.org/grpc"
)

type CommsClientConnection *grpc.ClientConn
Expand Down
1 change: 0 additions & 1 deletion apps/auth/internal/domain/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package domain
import (
"context"
"github.com/kloudlite/api/apps/auth/internal/entities"

"github.com/kloudlite/api/common"
"github.com/kloudlite/api/pkg/repos"
)
Expand Down
177 changes: 177 additions & 0 deletions apps/comms/email-templates/contact-us/email.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<!-- DO NOT EDIT: generated with `email.mjml` in their online editor -->
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">

<head>
<title>
</title>
<!--[if !mso]><!-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
#outlook a {
padding: 0;
}

body {
margin: 0;
padding: 0;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}

table,
td {
border-collapse: collapse;
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}

img {
border: 0;
height: auto;
line-height: 100%;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}

p {
display: block;
margin: 13px 0;
}
</style>
<!--[if mso]>
<noscript>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
</noscript>
<![endif]-->
<!--[if lte mso 11]>
<style type="text/css">
.mj-outlook-group-fix { width:100% !important; }
</style>
<![endif]-->
<!--[if !mso]><!-->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,700" rel="stylesheet" type="text/css">
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Open+Sans:300,400,500,700);
</style>
<!--<![endif]-->
<style type="text/css">
@media only screen and (min-width:480px) {
.mj-column-per-100 {
width: 100% !important;
max-width: 100%;
}
}
</style>
<style media="screen and (min-width:480px)">
.moz-text-html .mj-column-per-100 {
width: 100% !important;
max-width: 100%;
}
</style>
<style type="text/css">
@media only screen and (max-width:480px) {
table.mj-full-width-mobile {
width: 100% !important;
}

td.mj-full-width-mobile {
width: auto !important;
}
}
</style>
</head>

<body style="word-spacing:normal;background-color:#f7f7f7;">
<div style="background-color:#f7f7f7;">
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="margin:0px auto;max-width:600px;">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
<tbody>
<tr>
<td style="direction:ltr;font-size:0px;padding:20px 0;text-align:center;">
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]-->
<div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
<tbody>
<!-- image-ref: https://github.com/kloudlite/oss/issues/37 -->
<tr>
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse:collapse;border-spacing:0px;">
<tbody>
<tr>
<td style="width:120px;">
<img height="auto" src="https://raw.githubusercontent.com/kloudlite/static-assets/master/kloudlite-logo.png" style="border:0;display:block;outline:none;text-decoration:none;height:auto;width:100%;font-size:13px;" width="120" />
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]-->
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><table align="center" border="0" cellpadding="0" cellspacing="0" class="" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="margin:0px auto;max-width:600px;">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
<tbody>
<tr>
<td style="direction:ltr;font-size:0px;padding:20px 0;text-align:center;">
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:600px;" ><![endif]-->
<div class="mj-column-per-100 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:100%;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
<tbody>
<tr>
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<div style="font-family:Open Sans, Arial;font-size:18px;line-height:1.5;text-align:left;color:#333333;">Hello {{.Name}},</div>
</td>
</tr>
<tr>
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<div style="font-family:Open Sans, Arial;font-size:16px;line-height:1.5;text-align:left;color:#555555;">I’m Karthik, the founder of Kloudlite Inc and I’d like to personally thank you for contacting us.</div>
</td>
</tr>
<tr>
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<div style="font-family:Open Sans, Arial;font-size:16px;line-height:1.5;text-align:left;color:#555555;">We have received your details and our team will get back to you shortly.</div>
</td>
</tr>
<tr>
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<div style="font-family:Open Sans, Arial;font-size:14px;line-height:1;text-align:left;color:#888888;">Best Regards,</div>
</td>
</tr>
<tr>
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<div style="font-family:Open Sans, Arial;font-size:14px;line-height:1;text-align:left;color:#888888;">Karthik</div>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]-->
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]-->
</div>
</body>

</html>
32 changes: 32 additions & 0 deletions apps/comms/email-templates/contact-us/email.mjml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!-- vim: set ft=html: -->
<!-- DO NOT EDIT: copy this file, and edit in MJML online editor @ https://mjml.io/try-it-live -->
<mjml>
<mj-body background-color="#f7f7f7">
<mj-section padding="20px 0">
<mj-column width="100%">
<!-- image-ref: https://github.com/kloudlite/oss/issues/37 -->
<mj-image align="left" width="120px" src="https://raw.githubusercontent.com/kloudlite/static-assets/master/kloudlite-logo.png"></mj-image>
</mj-column>
</mj-section>
<mj-section padding="20px 0">
<mj-column>
<mj-text font-family="Open Sans, Arial" font-size="18px" color="#333" line-height="1.5">
Hello {{.Name}},
</mj-text>
<mj-text font-family="Open Sans, Arial" font-size="16px" color="#555" line-height="1.5">
I’m Karthik, the founder of Kloudlite Inc and I’d like to personally thank you for contacting us.
</mj-text>
<mj-text font-family="Open Sans, Arial" font-size="16px" color="#555" line-height="1.5">
We have received your details and our team will get back to you shortly.
</mj-text>
<mj-text font-family="Open Sans, Arial" font-size="14px" color="#888">
Best Regards,
</mj-text>
<mj-text font-family="Open Sans, Arial" font-size="14px" color="#888">
Karthik
</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>

8 changes: 8 additions & 0 deletions apps/comms/email-templates/contact-us/email.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Hello {{.Name}},

I’m Karthik, the founder of Kloudlite Inc and I’d like to personally thank you for contacting us.

We have received your details and our team will get back to you shortly.

Best Regards,
Karthik
30 changes: 30 additions & 0 deletions apps/comms/internal/app/grpc-server.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,36 @@ func (r *commsSvc) SendVerificationEmail(ctx context.Context, input *comms.Verif
}
return &comms.Void{}, nil
}

func (r *commsSvc) SendContactUsEmail(ctx context.Context, input *comms.SendContactUsEmailInput) (*comms.Void, error) {
plainText := new(bytes.Buffer)
args := map[string]any{
"Name": func() string {
if input.Name != "" {
return input.Name
}
return "there"
}(),
"CompanyName": input.CompanyName,
"Country": input.Country,
"Message": input.Message,
}

if err := r.eTemplattes.ContactUsEmail.PlainText.Execute(plainText, args); err != nil {
return nil, errors.NewEf(err, "failed to execute plain text template")
}

html := new(bytes.Buffer)
if err := r.eTemplattes.ContactUsEmail.Html.Execute(html, args); err != nil {
return nil, errors.NewEf(err, "failed to execute html template")
}

if err := r.sendSupportEmail(ctx, r.eTemplattes.ContactUsEmail.Subject, input.Email, input.Name, plainText.String(), html.String()); err != nil {
return nil, errors.NewE(err)
}
return &comms.Void{}, nil
}

func newCommsSvc(mailer mail.Mailer, ev *env.Env, et *domain.EmailTemplates) comms.CommsServer {
return &commsSvc{
mailer: mailer,
Expand Down
7 changes: 7 additions & 0 deletions apps/comms/internal/domain/mail-parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type EmailTemplates struct {
WelcomeEmail *EmailTemplate
WaitingEmail *EmailTemplate
AlertEmail *EmailTemplate
ContactUsEmail *EmailTemplate
}

func parseMailTemplate(et EmailTemplatesDir, templateName string, subject string) (*EmailTemplate, error) {
Expand Down Expand Up @@ -85,6 +86,11 @@ func GetEmailTemplates(et EmailTemplatesDir) (*EmailTemplates, error) {
return nil, err
}

contactUs, err := parseMailTemplate(et, "contact-us", "[Kloudlite] Contact Us")
if err != nil {
return nil, err
}

alert, err := parseMailTemplate(et, "alert", "[Kloudlite] Console Notification")

return &EmailTemplates{
Expand All @@ -94,6 +100,7 @@ func GetEmailTemplates(et EmailTemplatesDir) (*EmailTemplates, error) {
UserVerificationEmail: userVerification,
WelcomeEmail: welcome,
WaitingEmail: waiting,
ContactUsEmail: contactUs,
AlertEmail: alert,
}, nil
}
7 changes: 7 additions & 0 deletions apps/webhook/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ tasks:
out: "{{.binary}}-{{.GOARCH}}"
GOARCH: "{{.GOARCH}}"

webhook:run:
dotenv:
- .secrets/env
cmds:
- go build -o bin/webhook .
- ./bin/webhook --dev

container:build-and-push:
requires:
vars:
Expand Down
13 changes: 13 additions & 0 deletions apps/webhook/internal/app/app.go
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
package app

import (
"github.com/kloudlite/api/apps/webhook/internal/domain"
"github.com/kloudlite/api/grpc-interfaces/kloudlite.io/rpc/comms"
"github.com/kloudlite/api/pkg/grpc"
"github.com/kloudlite/api/pkg/messaging"
msgnats "github.com/kloudlite/api/pkg/messaging/nats"
"github.com/kloudlite/api/pkg/nats"
"go.uber.org/fx"
)

type CommsGrpcClient grpc.Client

var Module = fx.Module(
"app",
fx.Provide(func(client *nats.JetstreamClient) messaging.Producer {
return msgnats.NewJetstreamProducer(client)
}),

fx.Provide(
func(conn CommsGrpcClient) comms.CommsClient {
return comms.NewCommsClient(conn)
},
),

domain.Module,

LoadGitWebhook(),
)
Loading