Skip to content

Commit 62fcb8c

Browse files
committed
Finalize email sending
1 parent 7b10375 commit 62fcb8c

File tree

5 files changed

+10
-71
lines changed

5 files changed

+10
-71
lines changed

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Original credit: https://github.com/jpetazzo/dockvpn
22

33
# Smallest base image
4-
FROM node:current-alpine3.13
4+
FROM node:10.23.1-alpine3.9
55

66
# Testing: pamtester
77
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories && \
@@ -28,13 +28,13 @@ RUN apk --no-cache add curl
2828
RUN apk --no-cache add jq
2929
COPY start.sh /
3030
COPY mailing/* /mailing/
31-
RUN npm install -g yarn
32-
RUN cd /mailing && yarn
33-
#RUN ts-node /mailing/sendMails.ts
31+
RUN yarn --cwd /mailing
32+
RUN npm install typescript ts-node -g
3433

3534
# Add support for OTP authentication using a PAM module
3635
ADD ./otp/openvpn /etc/pam.d/
3736

3837
#START
39-
RUN chmod +x /start.sh
40-
CMD ["/start.sh"]
38+
RUN awk '{ sub("\r$", ""); print }' /start.sh > /start_unix.sh
39+
RUN chmod +x /start_unix.sh
40+
CMD ["./start_unix.sh"]

mailing/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
},
66
"devDependencies": {
77
"@types/dotenv": "^8.2.0",
8-
"@types/nodemailer": "^6.4.1",
9-
"ts-node": "^9.1.1",
10-
"typescript": "^4.2.4"
8+
"@types/nodemailer": "^6.4.1"
119
}
1210
}

mailing/sendMail.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Mail from 'nodemailer/lib/mailer';
44
const senderMail: string | undefined = process.env.SENDERMAIL
55
const senderPassword: string | undefined = process.env.SENDERPASSWORD
66
const recipientMail: string | undefined = process.env.RECIPIENTMAIL
7-
const domain: string | undefined = process.env.NGROK_URL
7+
const ngrok_url: string | undefined = process.env.NGROK_URL
88

99
var transporter = createTransport({
1010
service: 'gmail',
@@ -18,7 +18,7 @@ var transporter = createTransport({
1818
from: senderMail,
1919
to: recipientMail,
2020
subject: "New VPN Domain",
21-
text: domain,
21+
text: ngrok_url,
2222
};
2323

2424
transporter.sendMail(mailOptions, function(error, info){

mailing/yarn.lock

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -21,72 +21,12 @@
2121
dependencies:
2222
"@types/node" "*"
2323

24-
arg@^4.1.0:
25-
version "4.1.3"
26-
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
27-
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==
28-
29-
buffer-from@^1.0.0:
30-
version "1.1.1"
31-
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
32-
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==
33-
34-
create-require@^1.1.0:
35-
version "1.1.1"
36-
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
37-
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
38-
39-
diff@^4.0.1:
40-
version "4.0.2"
41-
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
42-
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
43-
4424
dotenv@*, dotenv@^8.2.0:
4525
version "8.2.0"
4626
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"
4727
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==
4828

49-
make-error@^1.1.1:
50-
version "1.3.6"
51-
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
52-
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
53-
5429
nodemailer@^6.5.0:
5530
version "6.5.0"
5631
resolved "https://registry.yarnpkg.com/nodemailer/-/nodemailer-6.5.0.tgz#d12c28d8d48778918e25f1999d97910231b175d9"
5732
integrity sha512-Tm4RPrrIZbnqDKAvX+/4M+zovEReiKlEXWDzG4iwtpL9X34MJY+D5LnQPH/+eghe8DLlAVshHAJZAZWBGhkguw==
58-
59-
source-map-support@^0.5.17:
60-
version "0.5.19"
61-
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61"
62-
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==
63-
dependencies:
64-
buffer-from "^1.0.0"
65-
source-map "^0.6.0"
66-
67-
source-map@^0.6.0:
68-
version "0.6.1"
69-
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
70-
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
71-
72-
ts-node@^9.1.1:
73-
version "9.1.1"
74-
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d"
75-
integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg==
76-
dependencies:
77-
arg "^4.1.0"
78-
create-require "^1.1.0"
79-
diff "^4.0.1"
80-
make-error "^1.1.1"
81-
source-map-support "^0.5.17"
82-
yn "3.1.1"
83-
84-
typescript@^4.2.4:
85-
version "4.2.4"
86-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.4.tgz#8610b59747de028fda898a8aef0e103f156d0961"
87-
integrity sha512-V+evlYHZnQkaz8TRBuxTA92yZBPotr5H+WhQ7bD3hZUndx5tGOa1fuCgeSjxAzM1RiN5IzvadIXTVefuuwZCRg==
88-
89-
90-
version "3.1.1"
91-
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
92-
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==

start.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ sleep 3
55
export NGROK_URL="$(curl http://localhost:4040/api/tunnels | jq ".tunnels[0].public_url")"
66
echo --------------------
77
echo $NGROK_URL
8+
cd mailing && ts-node sendMail.ts
89
echo --------------------
910
ovpn_run

0 commit comments

Comments
 (0)