Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin does not work correctly if zone-mta and wildduck use different databases #4

Open
taxilian opened this issue Jan 27, 2022 · 2 comments

Comments

@taxilian
Copy link
Contributor

Though all the documentation looked (to me) like it was recommended, putting wildduck and zone-mta into different mongodb databases does not work with the current plugin. The easiest way to fix it is to change:

const database = app.db.database;

to

const database = app.db.users;

I'm not sure if this is the best way or not as I'm still new to the project, but that's how I've fixed it; I don't know if anyone really puts users in a different database from the rest of wildduck but it seems unlikely. However, app.db.database will normally refer to the zone-mta database not the wildduck database. It has suddenly become apparent to me that most people have them sharing a database =]

@andris9
Copy link
Member

andris9 commented Jan 27, 2022

I think to get it working, you have to explicitly set the sender value in the DB configuration of ZoneMTA. In general, WildDuck and ZoneMTA can use the exact same DB configuration.

@taxilian
Copy link
Contributor Author

So to make that work (and it sounds plausible) then what you'd end up doing is putting the wildduck db in the connection string (for zone-mta) and then setting sender to the name of the zone-mta database... this seems more than a bit counter-intuitive.

The more I look at this the more I think the most correct fix would actually be to have an option in the plugin configuration which specifies the name of the wildduck database -- then it should use that if provided and then fall back to database if not provided. Barring that, the users database seems the most likely to usually be it.

I know (now) that you can use the same database for both, but that is not at all clear in the documentation that I read and so I didn't set it up that way; I can change it if needed, but I'd actually prefer not to because I hope to do some experimentation with zone-mta separately from the wildduck deployment.

Thoughts on my proposed solution? I don't really know much about the config system used here, so I'm picking things up based on inference from reading code; I'd like to fix this in a way that it will remain fixed without needing to maintain a separate copy of the plugin but also not breaking anyone else's slightly screwball deployment =] I'm happy to write some code to make it happen, but I don't want to spend a lot of time on a solution and have you reject it because it turns out it's a dumb idea when you actually understand the full picture =]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants