Skip to content

Commit

Permalink
refined config defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
boecks committed Oct 7, 2024
1 parent cb7078c commit dd8ee52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
7 changes: 4 additions & 3 deletions smtp2mqtt/smtp2mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
config_defaults = {
"SMTP_BIND_ADDRESS": "0.0.0.0",
"SMTP_LISTEN_PORT": "25",
"SMTP_AUTH_REQUIRED": "False",
"SMTP_AUTH_REQUIRED": "True",
"SMTP_RELAY_HOST": None,
"SMTP_RELAY_PORT": None,
"SMTP_RELAY_USER": None,
Expand All @@ -35,8 +35,9 @@
"MQTT_USER": None,
"MQTT_PASS": None,
"MQTT_TOPIC": "smtp2mqtt",
"PUBLISH_ATTACHMENTS": "False",
"SAVE_ATTACHMENTS_DIR": "/share",
"PUBLISH_ATTACHMENTS": "True",
"SAVE_ATTACHMENTS": "True",
"SAVE_ATTACHMENTS_DIR": "/share/smtp2mqtt",
"DEBUG": "True",
}

Expand Down
17 changes: 10 additions & 7 deletions smtp2mqtt/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,14 @@ SMTP_RELAY_PORT=${SMTP_RELAY_PORT:-""}
SMTP_RELAY_USER=${SMTP_RELAY_USER:-""}
SMTP_RELAY_PASS=${SMTP_RELAY_PASS:-""}
SMTP_RELAY_STARTTLS=${SMTP_RELAY_STARTTLS:-false}
SMTP_RELAY_TIMEOUT_SECS=${SMTP_RELAY_TIMEOUT_SECS:-60}
SMTP_RELAY_TIMEOUT_SECS=${SMTP_RELAY_TIMEOUT_SECS:-30}
MQTT_PORT=${MQTT_PORT:-1883}
MQTT_USER=${MQTT_USER:-""}
MQTT_PASS=${MQTT_PASS:-""}
MQTT_TOPIC=${MQTT_TOPIC:-"smtp2mqtt"}
PUBLISH_ATTACHMENTS=${PUBLISH_ATTACHMENTS:-true}
SAVE_ATTACHMENTS=${SAVE_ATTACHMENTS:-false}

# Debugging output
if [ "$DEBUG" = "true" ]; then
echo "Debug mode is enabled."
echo "MQTT_HOST: $MQTT_HOST"
fi

# Set the attachment save directory if needed
if [ "$SAVE_ATTACHMENTS" = "true" ]; then
SAVE_ATTACHMENTS_DIR=${SAVE_ATTACHMENTS_DIR:-"/share/smtp2mqtt"}
Expand All @@ -36,5 +30,14 @@ if [ "$SAVE_ATTACHMENTS" = "true" ]; then
}
fi

# Debugging output
if [ "$DEBUG" = "true" ]; then
echo "Debug mode is enabled."
echo "MQTT_HOST: $MQTT_HOST"
echo "SMTP_LISTEN_PORT: $SMTP_LISTEN_PORT"
echo "MQTT_PORT: $MQTT_PORT"
echo "MQTT_TOPIC: $MQTT_TOPIC"
fi

echo "Starting application..."
exec python3 /app/smtp2mqtt.py

0 comments on commit dd8ee52

Please sign in to comment.