Skip to content

Commit c140a40

Browse files
Make SMTP host setting configurable (#77)
* Allows to configure a STMP server different from the one in docker-compose * Addresses @ostefano regarding envvars with defaults * Ensures default is present in template.env
1 parent b6aaed5 commit c140a40

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

core/files/entrypoint_nginx.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ trap term_proc SIGTERM
1818
[ -z "$BASE_URL" ] && export BASE_URL="https://localhost"
1919
[ -z "$DISABLE_IPV6" ] && export DISABLE_IPV6=false
2020
[ -z "$DISABLE_SSL_REDIRECT" ] && export DISABLE_SSL_REDIRECT=false
21+
[ -z "$SMTP_FQDN" ] && export SMTP_FQDN=mail
2122

2223
init_mysql(){
2324
# Test when MySQL is ready....
@@ -93,7 +94,7 @@ class EmailConfig {
9394
public \$default = array(
9495
'transport' => 'Smtp',
9596
'from' => array('[email protected]' => 'Misp DEV'),
96-
'host' => 'mail',
97+
'host' => '$SMTP_FQDN',
9798
'port' => 25,
9899
'timeout' => 30,
99100
'client' => null,
@@ -102,7 +103,7 @@ class EmailConfig {
102103
public \$smtp = array(
103104
'transport' => 'Smtp',
104105
'from' => array('[email protected]' => 'Misp DEV'),
105-
'host' => 'mail',
106+
'host' => '$SMTP_FQDN',
106107
'port' => 25,
107108
'timeout' => 30,
108109
'client' => null,
@@ -128,7 +129,7 @@ class EmailConfig {
128129
'attachments' => null,
129130
'emailFormat' => null,
130131
'transport' => 'Smtp',
131-
'host' => 'mail',
132+
'host' => '$SMTP_FQDN',
132133
'port' => 25,
133134
'timeout' => 30,
134135
'client' => null,

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ services:
158158
- "MYSQL_DATABASE=${MYSQL_DATABASE:-misp}"
159159
# Debug setting
160160
- "DEBUG=${DEBUG}"
161+
# SMTP setting
162+
- "SMTP_FQDN=${SMTP_FQDN}"
161163

162164
misp-modules:
163165
image: ghcr.io/misp/misp-docker/misp-modules:latest

template.env

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ BASE_URL=
4444
# store settings in db except those that must stay in config.php. true/false, defaults to false
4545
ENABLE_DB_SETTINGS=
4646

47+
# Defines what mail system to use defaults to 'mail' which is provided in docker-compose.yml
48+
SMTP_FQDN=mail
49+
4750
# optional and used by the mail sub-system
4851
SMARTHOST_ADDRESS=
4952
SMARTHOST_PORT=

0 commit comments

Comments
 (0)