modmail-dev / Modmail

A Discord bot that functions as a shared inbox between staff and members, similar to Reddit's Modmail.
https://docs.modmail.dev
GNU Affero General Public License v3.0
1.58k stars 4.59k forks source link

Allow custom database name in config #3280

Closed skybird23333 closed 1 year ago

skybird23333 commented 1 year ago

Is your feature request related to a problem? Please elaborate.

Currently, when the bot connects to a MongoDB instance it uses the database name modmail_bot which is hard coded. This means a new MongoDB instance needs to be created for each instance of the bot.

Describe the solution you'd like

Allow the database name to be configured via .env, and have the following lines read from .env.

https://github.com/modmail-dev/modmail/blob/b21037cbd794a962569de6240c1d95c13009a64e/core/clients.py#L448

https://github.com/modmail-dev/modmail/blob/b21037cbd794a962569de6240c1d95c13009a64e/core/clients.py#L500

Does your solution involve any of the following?

Describe alternatives you've considered

Haven't thought of any, maybe to edit the source code directly(for users).

Who will this benefit?

People who need to host multiple modmail instances and don't want to make multiple MongoDB atlases/deploy multiple instances of the server for each bot.

Additional Information

No response

raidensakura commented 1 year ago

Duplicate of #3191