cvat-ai / cvat

Annotate better with CVAT, the industry-leading data engine for machine learning. Used and trusted by teams at any scale, for data of any scale.
https://cvat.ai
MIT License
12.23k stars 2.95k forks source link

Simplify Email Server Configuration (SMTP backend) #8152

Open shamspias opened 2 months ago

shamspias commented 2 months ago

Actions before raising this issue

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

Currently, configuring the email server for CVAT, which is Django-based, requires updating the settings.py(base.py) file and committing the changes. This process is cumbersome, especially when updates are released, necessitating a separate fork to maintain these configurations. I am requesting a more streamlined method for configuring the email server.

Problem Description Every time there is an update to CVAT, the code gets updated, and so does the repository. As a result, we have to manually update the base.py file to configure the email server. This process is not efficient as it requires committing the code and maintaining a separate fork to preserve these changes. This becomes a hassle with frequent updates.

Describe the solution you'd like

I suggest providing a way to configure the email server using environment variables in Docker. This would eliminate the need to update the settings.py(specifically base.py or production.py) file directly and make the process more straightforward. The required environment variables could include:

By doing this, the email configuration will be automatically applied based on the provided environment variables.

Benefits

Describe alternatives you've considered

Currently, the only alternative is manually updating the settings.py file and committing these changes, which is not efficient.

Additional context

Thank you for considering this feature request.

philcoyle123 commented 1 month ago

@shamspias Could you please explain your current updates that you perform to the settings.py(base.py) for this? Please note all your steps for clarity.

shamspias commented 1 month ago

Hi @philcoyle123,

I'm working on implementing mail configuration using Docker image variables. Instead of a custom configuration in base.py, I want to source it from Docker with email server values so it functions correctly after deployment and updates.

Currently, the email server configuration is not clearly documented, requiring manual edits to base.py. The email_settings.py file seems somewhat redundant.

Here's what I did to update base.py, and you can do the same for production.py or development.py by setting the mail server configuration like this:

EMAIL_BACKEND = os.getenv('EMAIL_BACKEND', 'django.core.mail.backends.smtp.EmailBackend')
EMAIL_HOST = os.getenv('EMAIL_HOST', 'localhost')
EMAIL_PORT = os.getenv('EMAIL_PORT', 1025)
EMAIL_FROM = os.getenv('EMAIL_FROM', 'noreply@somehost.local')
EMAIL_USE_TLS = os.getenv('EMAIL_USE_TLS', True)
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER', 'yourmail@yourmail.com')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD', 'password')

I am currently configuring the mail server manually, but it would be more efficient if these values could be set from Docker environment variables.

smit9924 commented 3 weeks ago

@philcoyle123 can we plan to have Ui using which admin user can setup it's email configurations. This will be helpful for non-developer admin as well. If you are agree with this then please assign this enhancement to me, so I can work on my idea further