milesmcc / shynet

Modern, privacy-friendly, and detailed web analytics that works without cookies or JS.
Apache License 2.0
2.89k stars 183 forks source link

Add the ability to create an admin user from environment variables #277

Open MatteoGauthier opened 1 year ago

MatteoGauthier commented 1 year ago

Hey ! Hope you're doing well, I wanted to know if it's possible to include admin default admin credentials. Especially with environment variables like ADMIN_EMAIL=<email> and ADMIN_PASSWORD=<secret>. Why with environment variables? Because in some cases, users might need to deploy shynet on a docker instance without having shell access. Environment variables are common knowledge and does not require knowing Django Admin.

What do you think of this approach? And do you have any ideas on how to integrate it into shynet (as a workaround to avoid having to use the instance shell) ? I'm thinking of adding this administrator login at startup.

Thank you for your time and this quality project. Have a nice day!

milesmcc commented 1 year ago

Hi @MatteoGauthier! This is certainly something we could consider. I'm hesitant to add default credentials (as in admin username and password password, for example), but I do think it would be OK to check whether certain environment variables are set at startup and create an admin user with those credentials if none already exists. Would someone be willing to open a PR with this change?