Browse Source
Merge pull request #669 from Budibase/moving-sendgrid
Minor patch - moving sendgrid API key to be a input of send email
pull/671/head
Michael Drury
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with
7 additions and
14 deletions
-
packages/builder/src/components/settings/tabs/APIKeys.svelte
-
packages/server/src/api/controllers/apikeys.js
-
packages/server/src/automations/steps/sendEmail.js
|
|
|
@ -5,7 +5,7 @@ |
|
|
|
import posthog from "posthog-js" |
|
|
|
import analytics from "analytics" |
|
|
|
|
|
|
|
let keys = { budibase: "", sendGrid: "" } |
|
|
|
let keys = { budibase: "" } |
|
|
|
|
|
|
|
async function updateKey([key, value]) { |
|
|
|
if (key === "budibase") { |
|
|
|
@ -42,14 +42,6 @@ |
|
|
|
value={keys.budibase} |
|
|
|
label="Budibase" /> |
|
|
|
</div> |
|
|
|
<div class="background"> |
|
|
|
<Input |
|
|
|
on:save={e => updateKey(['sendgrid', e.detail])} |
|
|
|
thin |
|
|
|
edit |
|
|
|
value={keys.sendgrid} |
|
|
|
label="Sendgrid" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<style> |
|
|
|
|
|
|
|
@ -7,7 +7,6 @@ exports.fetch = async function(ctx) { |
|
|
|
ctx.status = 200 |
|
|
|
ctx.body = { |
|
|
|
budibase: process.env.BUDIBASE_API_KEY, |
|
|
|
sendgrid: process.env.SENDGRID_API_KEY, |
|
|
|
userId: process.env.USERID_API_KEY, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -1,7 +1,3 @@ |
|
|
|
const environment = require("../../environment") |
|
|
|
const sgMail = require("@sendgrid/mail") |
|
|
|
sgMail.setApiKey(environment.SENDGRID_API_KEY) |
|
|
|
|
|
|
|
module.exports.definition = { |
|
|
|
description: "Send an email", |
|
|
|
tagline: "Send email to {{inputs.to}}", |
|
|
|
@ -13,6 +9,10 @@ module.exports.definition = { |
|
|
|
schema: { |
|
|
|
inputs: { |
|
|
|
properties: { |
|
|
|
apiKey: { |
|
|
|
type: "string", |
|
|
|
title: "SendGrid API key", |
|
|
|
}, |
|
|
|
to: { |
|
|
|
type: "string", |
|
|
|
title: "Send To", |
|
|
|
@ -49,6 +49,8 @@ module.exports.definition = { |
|
|
|
} |
|
|
|
|
|
|
|
module.exports.run = async function({ inputs }) { |
|
|
|
const sgMail = require("@sendgrid/mail") |
|
|
|
sgMail.setApiKey(inputs.apiKey) |
|
|
|
const msg = { |
|
|
|
to: inputs.to, |
|
|
|
from: inputs.from, |
|
|
|
|