Merge #883
883: Admin create user enhancement r=mergify[bot] a=cr1st1p ## What type of PR? Enhancement ## What does this PR do? It allows the admin docker image to also create the admin user. The idea is that in my kubernetes setup, I do not want to manually do anything, as such, I need a way for the admin user to also be created automatically without me getting inside the pod. So I had to change the manage.py function that creates the user to allow different 'modes' (me, I'll be using 'ifmissing') and also start.py to call that functionality if appropriate environment variables are present. So now, in my Deployment, I add 3 more environment variables and I get the admin user created, IF not already present. ### Related issue(s) none? ## Prerequistes Before we can consider review and merge, please make sure the following list is done and checked. If an entry in not applicable, you can check it or remove it from the list. - [x] In case of feature or enhancement: documentation updated accordingly - [x] Unless it's docs or a minor change: place entry in the [changelog](CHANGELOG.md), under the latest un-released version. Co-authored-by: cristi <cristi.posoiu@gmail.com> Co-authored-by: cr1st1p <cristi.posoiu@gmail.com> Co-authored-by: Tim Möhlmann <muhlemmer@gmail.com>master
commit
2785bca1f4
@ -1,5 +1,11 @@
|
||||
echo "Creating users ..."
|
||||
docker-compose -f tests/compose/core/docker-compose.yml exec admin flask mailu admin admin mailu.io password || exit 1
|
||||
echo "Users tests ..."
|
||||
# Should fail, admin is already auto-created
|
||||
docker-compose -f tests/compose/core/docker-compose.yml exec admin flask mailu admin admin mailu.io 'FooBar' && exit 1
|
||||
echo "The above error was intended!"
|
||||
# Should not fail, but does nothing; ifmissing mode
|
||||
docker-compose -f tests/compose/core/docker-compose.yml exec admin flask mailu admin admin mailu.io 'FooBar' --mode=ifmissing || exit 1
|
||||
# Should not fail and update the password; update mode
|
||||
docker-compose -f tests/compose/core/docker-compose.yml exec admin flask mailu admin admin mailu.io 'password' --mode=update || exit 1
|
||||
docker-compose -f tests/compose/core/docker-compose.yml exec admin flask mailu user user mailu.io 'password' 'SHA512-CRYPT' || exit 1
|
||||
docker-compose -f tests/compose/core/docker-compose.yml exec admin flask mailu user 'user/with/slash' mailu.io 'password' 'SHA512-CRYPT' || exit 1
|
||||
echo "Admin and user successfully created!"
|
||||
echo "User testing succesfull!"
|
||||
|
Loading…
Reference in New Issue