Browse Source

Can now test with docker

master
John Shaver 2 months ago
parent
commit
e4e6eb0f4f
5 changed files with 26 additions and 3 deletions
  1. 1
    0
      .gitignore
  2. 2
    1
      Dockerfile
  3. 13
    0
      docker-compose.yml
  4. 9
    2
      index.js
  5. 1
    0
      templates/testTemplate.js

+ 1
- 0
.gitignore View File

@@ -1 +1,2 @@
1 1
 node_modules
2
+.env

+ 2
- 1
Dockerfile View File

@@ -9,5 +9,6 @@ RUN haraka -i /app
9 9
 RUN echo webmailer >> /app/config/plugins
10 10
 RUN echo "listen=[::0]:8080" >> /app/config/http.ini
11 11
 RUN echo "listen=[::0]:2525" >> /app/config/smtp.ini
12
-COPY testing/testTemplate.js /app/plugins/webmailer/templates/testTemplate.js
12
+COPY testing/testTemplate.js /app/templates
13
+COPY . /app/plugins/webmailer
13 14
 CMD haraka -c /app

+ 13
- 0
docker-compose.yml View File

@@ -0,0 +1,13 @@
1
+version: '3'
2
+
3
+services:
4
+  mail:
5
+    env_file:
6
+      - .env
7
+    build:
8
+      context: .
9
+    ports:
10
+      - '8080:8080'
11
+      - '2525:2525'
12
+    volumes:
13
+      - ./:/app/plugins/webmailer

+ 9
- 2
index.js View File

@@ -2,11 +2,18 @@ let fs = require('fs');
2 2
 
3 3
 let bodyParser = require('body-parser');
4 4
 let outbound;
5
-
6
-let getTemplates = require('./templates');
5
+let getTemplates;
7 6
 let errorSender = require('./errorSender');
8 7
 exports.register = function() {
9 8
   outbound = this.haraka_require('./outbound');
9
+  try {
10
+    getTemplates = this.haraka_require('./templates');
11
+    if(!getTemplates || !Object.keys(getTemplates).length) {
12
+      throw Error ("No templates loaded!");
13
+    } 
14
+  }catch(e) {
15
+    this.logerror("No email templates were loaded! Please add a templates directory with templates and try agin");
16
+  }
10 17
   this.register_hook('init_http', 'initExpress');
11 18
 }
12 19
 

+ 1
- 0
templates/testTemplate.js View File

@@ -0,0 +1 @@
1
+../testing/testTemplate.js

Loading…
Cancel
Save