smeserver-onlyoffice/root/etc/e-smith/db/configuration/migrate/50onlyoffice

28 lines
910 B
Plaintext

{
my $onlyoffice = $DB->get('onlyoffice') || $DB->new_record('onlyoffice', {type => 'configuration'});
my $token = $onlyoffice->prop('token') || '';
my $secretString = $onlyoffice->prop('secretString') || '';
# If the management interface is already defined, return nothing
if ($token eq '') {
# Else, we generate a random password
my $pass=`/usr/bin/openssl rand -base64 32 | tr -c -d '[:alnum:]'`;
$onlyoffice->set_prop('token',"$pass");
}
if ($secretString eq '') {
# Else, we generate a random password
my $pass=`/usr/bin/openssl rand -base64 60 | tr -c -d '[:alnum:]'`;
$onlyoffice->set_prop('secretString',"$pass");
}
#dbpass
my $dbpass = $onlyoffice->prop('dbpass') || '';
if ($dbpass eq '') {
my $pass=`/usr/bin/openssl rand -base64 60 | tr -c -d '[:alnum:]'`;
$onlyoffice->set_prop('dbpass',"$pass");
}
}