Tecnativa / doodba-scaffolding

Officially supported scaffolding template for your Doodba projects
Other
11 stars 38 forks source link

[DCK] Support default from address #43

Closed yajo closed 5 years ago

yajo commented 5 years ago

Just like https://github.com/odoo/odoo/pull/36837 introduces this feature per database, here we're going to add support for it in Doodba directly, via config file, as it is currently supported in Odoo.

You should fill this new env variable with the address that should be used as a default sender address in case the mail template doesn't supply one, which is a not-so-uncommon case.

Usually it should match your mail.catchall.alias@mail.catchall.domain combination, or the same value as for $SMTP_REAL_RELAY_USER, but it could be any other.

@Tecnativa TT19448

pedrobaeza commented 5 years ago

This will mean a retro-compatibility problem updating the scaffolding, as now the "email from" will be postmaster@example.com if not changed to the same as the project. I think you have to put it empty and default to SMTP_REAL_RELAY_USER if not filled

yajo commented 5 years ago

Yes, I thought about that, but the problem is that there's no syntax to set a variable default value. You can only set a static default value for a missing variable, as seen here:

https://github.com/Tecnativa/doodba-scaffolding/blob/2275539023cdfafe8e2146ffe7ac1350af4db736/common.yaml#L9-L10

I tested and if I put there EMAIL_FROM: "${SMTP_DEFAULT_FROM:-$SMTP_REAL_RELAY_USER}" and $SMTP_DEFAULT_FROM is empty, the result is a string with $SMTP_REAL_RELAY_USER literally (no env var resolution).

However, there's still the possibility to set it empty by default. The behavior if you leave it like that will be the same as until today.

In any case, this kind of update is one of those that almost in 100% of the cases will produce a merge conflict, so the dev attention will be called to the matter when updating the scaffolding (it's not as dangerous as the cases when the update lands unnoticed).

So, do we leave it as it is, or do I default it to an empty string? :thinking:

pedrobaeza commented 5 years ago

OK, I see. It's a pity... I would say any way to leave it empty, as in conflict resolution, most people won't know about this, and simply resolve the conflict without adjusting that part.