I’ve created a strapi plugin, which automatically creates the admin user on the development environment.
The first step verifies if the
strapi-super-admin role exists; if it doesn’t exist, it creates one. The second step verifies if the admin user exists; if it doesn’t exist, it creates one with the
yarn add strapi-plugin-bootstrap-admin-user
npm install strapi-plugin-bootstrap-admin-user
Credentials will be outputed in console on the First run in the development environment.
You can also define default credentials in .env with the following variables:
Note: Please use it only in the development environment.
Feel free to check it out on npm. Also, feel free to contribute to it on GitHub.
Awesome thank you @sunnyson
Awesome plugin! I wanted to run this on my other environments besides development. But I was curious why did you choose to just run it on development? I understand the security concerns of creating a weak admin user but having the script setup with environment variables I am planning on passing those into the running process in the other environments. Thoughts?
Hmm, yeah, I’ve limited it to dev env to avoid cases when someone forgets about it when migrating to prod. I will add tomorrow an extra env variable that will allow the plugin to be runned in any env.
In my case I use it only on dev, as all my local projects have the same credentials for faster development and seamless switching between projects. Also, I’ve added a button to VS code that adds the package automatically when clicking on it, if you want I can share it too. As it is very useful to create the Admin user in one click without typing
yarn add strapi-plugin-bootstrap-admin-user.
I’ve added a new env variable:
DEV_ADMIN_ALLOW. Set it to
true to allow admin creation in any environment.
Update plugin to
Awesome! I am going give it a try. Thanks for making the update!!
We do love pull requests to that repo and I am the one who reviews and merges them