Add way to set root password by environment.

Add a condition test to pass by environment a predetermined
root password for setting up.
This commit is contained in:
Axel Viala 2019-05-15 00:18:48 +02:00 committed by Chocobozzz
parent 11b3f14c75
commit 3daaa19274
2 changed files with 5 additions and 0 deletions

View File

@ -128,6 +128,8 @@ async function createOAuthAdminIfNotExist () {
// Our password is weak so do not validate it // Our password is weak so do not validate it
validatePassword = false validatePassword = false
} else if (process.env.PT_INITIAL_ROOT_PASSWORD) {
password = process.env.PT_INITIAL_ROOT_PASSWORD
} else { } else {
password = passwordGenerator(16, true) password = passwordGenerator(16, true)
} }

View File

@ -204,6 +204,9 @@ logs. You can set another password with:
$ cd /var/www/peertube/peertube-latest && NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root $ cd /var/www/peertube/peertube-latest && NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production npm run reset-password -- -u root
``` ```
Alternatively you can set the environment variable `PT_INITIAL_ROOT_PASSWORD`,
to your own administrator password, although it must be 6 characters or more.
### What now? ### What now?
Now your instance is up you can: Now your instance is up you can: