This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install client-side tool into /usr/local/bin/ | |
$ wget https://github.com/bitnami-labs/sealed-secrets/releases/download/v0.8.3/kubeseal-$(go env GOOS)-$(go env GOARCH) -O kubeseal | |
$ sudo install -m 755 kubeseal /usr/local/bin/kubeseal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
faas-cli cloud seal --name red-gold-secrets \ | |
--literal password="password" --literal email="example@gmail.com" --literal sign-secret="slack_signing_secret" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd $HOME/mail-of-slack | |
curl -O https://raw.githubusercontent.com/openfaas/cloud-functions/master/pub-cert.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Email callback handler | |
const emailCallback = (emailResult) => { | |
let result = null | |
if (emailResult.error) { | |
result = { | |
"text": "There is problem!", | |
"attachments": [ | |
{ | |
"text": JSON.stringify(emailResult.error) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict" | |
const qs = require('qs'); | |
const utils = require('./utils') | |
module.exports = (context, callback) => { | |
// Parse query string | |
const data = qs.parse(context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require('crypto'); | |
const qs = require('qs'); | |
const fs = require('fs'); | |
const nodemailer = require('nodemailer'); | |
const md = require('markdown-it')({ | |
html: true, | |
linkify: true, | |
breaks: true, | |
typographer: true | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd $HOME/mail-of-slack/slack-mail | |
npm install --save markdown-it@9.1.0 markdown-it-emoji@1.4.0 nodemailer@6.3.0 qs@6.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 1.0 | |
provider: | |
name: openfaas | |
gateway: http://127.0.0.1:8080 | |
functions: | |
slack-mail: | |
lang: node | |
handler: ./slack-mail | |
image: slack-mail:latest | |
labels: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Call OpenFaaS API | |
curl https://red-gold.o6s.io/slack-mail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git init | |
git add . | |
git commit -sm 'Init test' | |
# Set remote to my github account repository | |
git remote add origin git@github.com:red-gold/slack-of-mail.git | |
# Push to repository | |
git push --set-upstream origin master -f |