mcuadros / ofelia

A docker job scheduler (aka. crontab for docker)
MIT License
3.01k stars 174 forks source link

Email config.ini global vs per job configuration? #139

Open DoTheEvo opened 3 years ago

DoTheEvo commented 3 years ago

So I am testing ofelia, got to logging and email notification. It seems that global is not as useful one would expect

[global]
smtp-user = apikey
smtp-password = SG.***************************
smtp-host = smtp.sendgrid.net
smtp-port = 465

[job-exec "test1"]
schedule = @every 5m
container = phpipam_phpipam-web_1
command = touch /tmp/zla
mail-only-on-error = false
email-to = whoever@example.com
email-from = test@example.com

[job-exec "test2"]
schedule = @every 2m
container = phpipam_phpipam-mariadb_1
command = touch /tmp/zla

The above does not work, gets error about missing stuff. It seems if I would start using ofelia on larger scale I would have to have fully filled out smtp settings and everything related to email fully at every job that would use email.

I could have it all in global, but then every job would have it set without way to opt out.

Maybe global settings should be kinda like defaults, unless overwritten in local job. If there is valid email in email-to set either in global or in a job it then should go for it and send it. But if its not there, and there are only smtp settings and some other settings but email-to is empty it should not try.

thijskaspers commented 3 years ago

+1, I was expecting it to work like this, but now you have to repeat the settings at each cronjob task.

DevDavido commented 2 years ago

+1, I was expecting it to work like this, but now you have to repeat the settings at each cronjob task.

Exactly same DX issue here as well. It would be great to be able to specify the email properties globally and be able to overwrite them (if needed) at the job specification locally.