Kaynağa Gözat

Enable email

Girish Ramakrishnan 8 yıl önce
ebeveyn
işleme
3acccdb6ad
3 değiştirilmiş dosya ile 10 ekleme ve 2 silme
  1. 2 2
      CloudronManifest.json
  2. 1 0
      Dockerfile
  3. 7 0
      start.sh

+ 2 - 2
CloudronManifest.json

@@ -9,9 +9,9 @@
   "httpPort": 4567,
   "addons": {
     "localstorage": {},
-    "mongodb": {}
+    "mongodb": {},
+    "sendmail": {}
   },
-  "minBoxVersion": "0.0.1",
   "manifestVersion": 1,
   "website": "https://nodebb.org/",
   "contactEmail": "support@cloudron.io",

+ 1 - 0
Dockerfile

@@ -8,6 +8,7 @@ WORKDIR /app/code
 RUN curl -L https://github.com/NodeBB/NodeBB/archive/v1.1.0.tar.gz | tar -xz --strip-components 1 -f -
 ADD config.json.template /app/code
 RUN npm install --production
+RUN npm install nodebb-plugin-emailer-local-bobo
 RUN mv /app/code/node_modules /app/code/node_modules_copy
 RUN ln -s /run/nodebb/node_modules /app/code/node_modules
 

+ 7 - 0
start.sh

@@ -2,6 +2,8 @@
 
 set -eu
 
+mongo_cli="mongo ${MONGODB_HOST}:${MONGODB_PORT}/${MONGODB_DATABASE} -u ${MONGODB_USERNAME} -p ${MONGODB_PASSWORD}"
+
 echo "Creating directories"
 mkdir -p /app/data/public/uploads /run/nodebb/logs /run/nodebb/public /run/nodebb/node_modules
 
@@ -77,5 +79,10 @@ done
 echo "Updating nodebb"
 node /app/code/app --upgrade
 
+echo "Enabling the local mailer"
+/usr/local/bin/gosu cloudron:cloudron /app/code/nodebb activate nodebb-plugin-emailer-local-bobo --config /run/nodebb/config.json
+${mongo_cli} --eval "db.objects.update({ _key: \"settings:emailer-local\" }, { \$set: { \"emailer:local:host\": \"${MAIL_SMTP_SERVER}\", \"emailer:local:port\": \"${MAIL_SMTP_PORT}\", \"emailer:local:username\": \"${MAIL_SMTP_USERNAME}\", \"emailer:local:password\": \"${MAIL_SMTP_PASSWORD}\", \"emailer:local:secure\": \"off\" } }, { upsert: true })"
+
+${mongo_cli} --eval "db.objects.update({ _key: \"config\" }, { \$set: { \"email:from\": \"${MAIL_FROM}\" } }, { upsert: true })"
 echo "Starting nodebb"
 /usr/local/bin/gosu cloudron:cloudron node /app/code/loader.js --no-daemon --no-silent --config /run/nodebb/config.json