Provide command line variables for initializing an admin user. Previously to get admin access on a fresh install I had to create a user in the web interface (to make sure the password hash/salt is properly setup) then manually change the role in the database to 'admin' using a postgresql client. This was a pain in the ass, and I think there really needs to be an easy way to create the admin user on the initial deployment. This solution fixes this, and adds documentation to the README file on how to use those variables.

This commit is contained in:
endangered 2019-11-25 06:58:44 +09:30
parent defaa2ae0b
commit f836f40f89
5 changed files with 62 additions and 2 deletions

View file

@ -37,6 +37,13 @@ You can run it (using `/var/lib/trantor` for storage):
# $GOPATH/bin/trantor -assets $GOPATH/src/pkg/gitlab.com/trantor/trantor/ -store /var/lib/trantor
```
The first time you run it, the database will be initialized. To initialize an admin user, include the -set-admin-user and -set-admin-pass variables
when you run it. The admin user will be initialized after the first time you run the application with these parameters, so there is no need to
include them on subsequent runs (but no harm in doing so).
```
# $GOPATH/bin/trantor -assets $GOPATH/src/pkg/gitlab.com/trantor/trantor/ -store /var/lib/trantor -set-admin-user 'admin' -set-admin-pass 'MY_ADMIN_PASSWORD'
```
Go to your browser to: http://localhost:8080
### For developers
@ -49,7 +56,7 @@ $ go build
Now you can run it:
```
$ ./trantor
$ ./trantor -set-admin-user 'admin' -set-admin-pass 'MY_ADMIN_PASSWORD'
```
Go to your browser to: http://localhost:8080