2022-09-29 16:38:54 +02:00
|
|
|
const { success } = require("../utils")
|
|
|
|
const { updateDockerComposeService } = require("./utils")
|
|
|
|
const randomString = require("randomstring")
|
2022-09-30 18:13:50 +02:00
|
|
|
const { GENERATED_USER_EMAIL } = require("../constants")
|
2022-09-29 16:38:54 +02:00
|
|
|
|
2022-09-30 18:13:50 +02:00
|
|
|
exports.generateUser = async (password, silent) => {
|
|
|
|
const email = GENERATED_USER_EMAIL
|
|
|
|
if (!password) {
|
|
|
|
password = randomString.generate({ length: 6 })
|
|
|
|
}
|
2022-09-29 16:38:54 +02:00
|
|
|
updateDockerComposeService(service => {
|
|
|
|
service.environment["BB_ADMIN_USER_EMAIL"] = email
|
|
|
|
service.environment["BB_ADMIN_USER_PASSWORD"] = password
|
|
|
|
})
|
2022-09-30 18:13:50 +02:00
|
|
|
if (!silent) {
|
|
|
|
console.log(
|
|
|
|
success(
|
|
|
|
`User admin credentials configured, access with email: ${email} - password: ${password}`
|
|
|
|
)
|
2022-09-29 16:38:54 +02:00
|
|
|
)
|
2022-09-30 18:13:50 +02:00
|
|
|
}
|
2022-09-29 16:38:54 +02:00
|
|
|
}
|