mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
PHRAS-3798 bin/setup - system:config set - return sensitive credential on stdout (#4247)
* system:config use quiet option * remove -q from some properties * remove debug auto-install.sh
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -xe
|
set -e
|
||||||
|
|
||||||
if [ -z "$PHRASEANET_ADMIN_ACCOUNT_EMAIL" ]; then
|
if [ -z "$PHRASEANET_ADMIN_ACCOUNT_EMAIL" ]; then
|
||||||
echo "PHRASEANET_ADMIN_ACCOUNT_EMAIL, Phraseanet admin account var is not set."
|
echo "PHRASEANET_ADMIN_ACCOUNT_EMAIL, Phraseanet admin account var is not set."
|
||||||
|
@@ -68,14 +68,14 @@ if [[ -f "$FILE" && $PHRASEANET_SETUP = 1 ]]; then
|
|||||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - $FILE exists, start setup ."
|
echo `date +"%Y-%m-%d %H:%M:%S"` " - $FILE exists, start setup ."
|
||||||
|
|
||||||
if [[ $PHRASEANET_PROJECT_NAME && $ENV_SET_PHRASEANET_PROJECT_NAME == 1 ]]; then
|
if [[ $PHRASEANET_PROJECT_NAME && $ENV_SET_PHRASEANET_PROJECT_NAME == 1 ]]; then
|
||||||
bin/setup system:config set registry.general.title "$PHRASEANET_PROJECT_NAME"
|
bin/setup system:config set -q registry.general.title "$PHRASEANET_PROJECT_NAME"
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet Title is set to $PHRASEANET_PROJECT_NAME"
|
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet Title is set to $PHRASEANET_PROJECT_NAME"
|
||||||
else
|
else
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet instance name is NOT set to $PHRASEANET_PROJECT_NAME because ENV_SET_PHRASEANET_PROJECT_NAME is set to $ENV_SET_PHRASEANET_PROJECT_NAME "
|
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet instance name is NOT set to $PHRASEANET_PROJECT_NAME because ENV_SET_PHRASEANET_PROJECT_NAME is set to $ENV_SET_PHRASEANET_PROJECT_NAME "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet Static URL PHRASEANET_BASE_URL"
|
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet Static URL PHRASEANET_BASE_URL"
|
||||||
bin/setup system:config set servername $PHRASEANET_BASE_URL
|
bin/setup system:config set -q servername $PHRASEANET_BASE_URL
|
||||||
|
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet Setting available language in GUI and search"
|
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet Setting available language in GUI and search"
|
||||||
counter=0
|
counter=0
|
||||||
@@ -92,7 +92,7 @@ if [[ -f "$FILE" && $PHRASEANET_SETUP = 1 ]]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bin/setup system:config set languages.default $PHRASEANET_DEFAULT_LANGUAGE
|
bin/setup system:config set -q languages.default $PHRASEANET_DEFAULT_LANGUAGE
|
||||||
|
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet setting for Trusted Proxies"
|
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet setting for Trusted Proxies"
|
||||||
counter=0
|
counter=0
|
||||||
@@ -139,19 +139,19 @@ if [[ -f "$FILE" && $PHRASEANET_SETUP = 1 ]]; then
|
|||||||
|
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "Overwriting Phraseanet Database connexion informations"
|
echo `date +"%Y-%m-%d %H:%M:%S"` - "Overwriting Phraseanet Database connexion informations"
|
||||||
|
|
||||||
bin/setup system:config set main.database.host $PHRASEANET_DB_HOST
|
bin/setup system:config set -q main.database.host $PHRASEANET_DB_HOST
|
||||||
bin/setup system:config set main.database.port $PHRASEANET_DB_PORT
|
bin/setup system:config set -q main.database.port $PHRASEANET_DB_PORT
|
||||||
bin/setup system:config set main.database.user $PHRASEANET_DB_USER
|
bin/setup system:config set -q main.database.user $PHRASEANET_DB_USER
|
||||||
bin/setup system:config set main.database.password $PHRASEANET_DB_PASSWORD
|
bin/setup system:config set -q main.database.password $PHRASEANET_DB_PASSWORD
|
||||||
bin/setup system:config set main.database.dbname $INSTALL_APPBOX
|
bin/setup system:config set -q main.database.dbname $INSTALL_APPBOX
|
||||||
|
|
||||||
## Phraseanet application cache setting
|
## Phraseanet application cache setting
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "Setting up for Phraseanet cache"
|
echo `date +"%Y-%m-%d %H:%M:%S"` - "Setting up for Phraseanet cache"
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` - "Cache Type is $PHRASEANET_CACHE_TYPE"
|
echo `date +"%Y-%m-%d %H:%M:%S"` - "Cache Type is $PHRASEANET_CACHE_TYPE"
|
||||||
bin/setup system:config set main.cache.options.host $PHRASEANET_CACHE_HOST
|
bin/setup system:config set -q main.cache.options.host $PHRASEANET_CACHE_HOST
|
||||||
bin/setup system:config set main.cache.options.port $PHRASEANET_CACHE_PORT
|
bin/setup system:config set -q main.cache.options.port $PHRASEANET_CACHE_PORT
|
||||||
bin/setup system:config set main.cache.options.namespace $PHRASEANET_HOSTNAME
|
bin/setup system:config set -q main.cache.options.namespace $PHRASEANET_HOSTNAME
|
||||||
bin/setup system:config set main.cache.type $PHRASEANET_CACHE_TYPE
|
bin/setup system:config set -q main.cache.type $PHRASEANET_CACHE_TYPE
|
||||||
|
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet setting external Binaries timeout "
|
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet setting external Binaries timeout "
|
||||||
bin/setup system:config set main.binaries.ffmpeg_timeout $PHRASEANET_FFMPEG_TIMEOUT
|
bin/setup system:config set main.binaries.ffmpeg_timeout $PHRASEANET_FFMPEG_TIMEOUT
|
||||||
@@ -174,23 +174,23 @@ if [[ -f "$FILE" && $PHRASEANET_SETUP = 1 ]]; then
|
|||||||
bin/setup system:config set workers.queue.worker-queue.vhost $PHRASEANET_RABBITMQ_VHOST
|
bin/setup system:config set workers.queue.worker-queue.vhost $PHRASEANET_RABBITMQ_VHOST
|
||||||
bin/setup system:config set workers.queue.worker-queue.ssl $PHRASEANET_RABBITMQ_SSL
|
bin/setup system:config set workers.queue.worker-queue.ssl $PHRASEANET_RABBITMQ_SSL
|
||||||
bin/setup system:config set workers.queue.worker-queue.heartbeat $PHRASEANET_RABBITMQ_HEARTBEAT
|
bin/setup system:config set workers.queue.worker-queue.heartbeat $PHRASEANET_RABBITMQ_HEARTBEAT
|
||||||
bin/setup system:config set workers.queue.worker-queue.user $PHRASEANET_RABBITMQ_USER
|
bin/setup system:config set -q workers.queue.worker-queue.user $PHRASEANET_RABBITMQ_USER
|
||||||
bin/setup system:config set workers.queue.worker-queue.password $PHRASEANET_RABBITMQ_PASSWORD
|
bin/setup system:config set -q workers.queue.worker-queue.password $PHRASEANET_RABBITMQ_PASSWORD
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet setting SMTP "
|
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet setting SMTP "
|
||||||
if [[ $PHRASEANET_SMTP_ENABLED && $PHRASEANET_SMTP_ENABLED = true ]]; then
|
if [[ $PHRASEANET_SMTP_ENABLED && $PHRASEANET_SMTP_ENABLED = true ]]; then
|
||||||
bin/setup system:config set registry.email.smtp-enabled $PHRASEANET_SMTP_ENABLED
|
bin/setup system:config set -q registry.email.smtp-enabled $PHRASEANET_SMTP_ENABLED
|
||||||
bin/setup system:config set registry.email.smtp-auth-enabled $PHRASEANET_SMTP_AUTH_ENABLED
|
bin/setup system:config set -q registry.email.smtp-auth-enabled $PHRASEANET_SMTP_AUTH_ENABLED
|
||||||
bin/setup system:config set registry.email.smtp-secure-mode $PHRASEANET_SMTP_SECURE_MODE
|
bin/setup system:config set -q registry.email.smtp-secure-mode $PHRASEANET_SMTP_SECURE_MODE
|
||||||
bin/setup system:config set registry.email.smtp-host $PHRASEANET_SMTP_HOST
|
bin/setup system:config set -q registry.email.smtp-host $PHRASEANET_SMTP_HOST
|
||||||
bin/setup system:config set registry.email.smtp-port $PHRASEANET_SMTP_PORT
|
bin/setup system:config set -q registry.email.smtp-port $PHRASEANET_SMTP_PORT
|
||||||
bin/setup system:config set registry.email.smtp-user $PHRASEANET_SMTP_USER
|
bin/setup system:config set -q registry.email.smtp-user $PHRASEANET_SMTP_USER
|
||||||
bin/setup system:config set registry.email.smtp-password $PHRASEANET_SMTP_PASSWORD
|
bin/setup system:config set -q registry.email.smtp-password $PHRASEANET_SMTP_PASSWORD
|
||||||
bin/setup system:config set registry.email.emitter-email $PHRASEANET_EMITTER_EMAIL
|
bin/setup system:config set -q registry.email.emitter-email $PHRASEANET_EMITTER_EMAIL
|
||||||
bin/setup system:config set registry.email.prefix "$PHRASEANET_MAIL_OBJECT_PREFIX"
|
bin/setup system:config set -q registry.email.prefix "$PHRASEANET_MAIL_OBJECT_PREFIX"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet root account Password sync"
|
echo `date +"%Y-%m-%d %H:%M:%S"` " - Phraseanet root account Password sync"
|
||||||
|
@@ -13,6 +13,7 @@ use Symfony\Component\Yaml\Yaml;
|
|||||||
class ConfigurationEditor extends Command
|
class ConfigurationEditor extends Command
|
||||||
{
|
{
|
||||||
private $noCompile = false;
|
private $noCompile = false;
|
||||||
|
private $quiet = false;
|
||||||
|
|
||||||
public function __construct($name)
|
public function __construct($name)
|
||||||
{
|
{
|
||||||
@@ -47,6 +48,7 @@ class ConfigurationEditor extends Command
|
|||||||
$command = $input->getArgument('operation');
|
$command = $input->getArgument('operation');
|
||||||
$parameter = $input->getArgument('parameter');
|
$parameter = $input->getArgument('parameter');
|
||||||
$this->noCompile = $input->getOption('no-compile');
|
$this->noCompile = $input->getOption('no-compile');
|
||||||
|
$this->quiet = $input->getOption('quiet');
|
||||||
|
|
||||||
$parameterNodes = explode('.', $parameter);
|
$parameterNodes = explode('.', $parameter);
|
||||||
|
|
||||||
@@ -86,7 +88,9 @@ class ConfigurationEditor extends Command
|
|||||||
$current = $current[$paramName];
|
$current = $current[$paramName];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->quiet) {
|
||||||
$output->writeln('<info>Getting configuration entry</info> ' . $parameter);
|
$output->writeln('<info>Getting configuration entry</info> ' . $parameter);
|
||||||
|
}
|
||||||
|
|
||||||
$this->printConfigurationValue($output, $parameter, $current);
|
$this->printConfigurationValue($output, $parameter, $current);
|
||||||
}
|
}
|
||||||
@@ -102,7 +106,9 @@ class ConfigurationEditor extends Command
|
|||||||
$configurationRoot = $configurationStore->getConfig();
|
$configurationRoot = $configurationStore->getConfig();
|
||||||
$configurationCurrent = & $configurationRoot;
|
$configurationCurrent = & $configurationRoot;
|
||||||
|
|
||||||
|
if (!$this->quiet) {
|
||||||
$output->writeln('<info>Writing value to configuration entry</info> ' . $parameter);
|
$output->writeln('<info>Writing value to configuration entry</info> ' . $parameter);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($parameterNodes as $paramName) {
|
foreach ($parameterNodes as $paramName) {
|
||||||
if (! isset($configurationCurrent[$paramName])) {
|
if (! isset($configurationCurrent[$paramName])) {
|
||||||
@@ -123,7 +129,9 @@ class ConfigurationEditor extends Command
|
|||||||
$configurationStore->compileAndWrite();
|
$configurationStore->compileAndWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->quiet) {
|
||||||
$output->writeln('<comment>Reading updated configuration value</comment>');
|
$output->writeln('<comment>Reading updated configuration value</comment>');
|
||||||
|
}
|
||||||
|
|
||||||
$this->readConfigurationValue($output, $parameter, $parameterNodes);
|
$this->readConfigurationValue($output, $parameter, $parameterNodes);
|
||||||
}
|
}
|
||||||
@@ -139,7 +147,9 @@ class ConfigurationEditor extends Command
|
|||||||
$configurationRoot = $configurationStore->getConfig();
|
$configurationRoot = $configurationStore->getConfig();
|
||||||
$configurationCurrent = & $configurationRoot;
|
$configurationCurrent = & $configurationRoot;
|
||||||
|
|
||||||
|
if (!$this->quiet) {
|
||||||
$output->writeln('<info>Appending value to configuration entry</info> ' . $parameter);
|
$output->writeln('<info>Appending value to configuration entry</info> ' . $parameter);
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($parameterNodes as $paramName) {
|
foreach ($parameterNodes as $paramName) {
|
||||||
if (! isset($configurationCurrent[$paramName])) {
|
if (! isset($configurationCurrent[$paramName])) {
|
||||||
@@ -170,21 +180,25 @@ class ConfigurationEditor extends Command
|
|||||||
$configurationStore->compileAndWrite();
|
$configurationStore->compileAndWrite();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->quiet) {
|
||||||
$output->writeln('<comment>Reading updated configuration value</comment>');
|
$output->writeln('<comment>Reading updated configuration value</comment>');
|
||||||
|
}
|
||||||
|
|
||||||
$this->readConfigurationValue($output, $parameter, $parameterNodes);
|
$this->readConfigurationValue($output, $parameter, $parameterNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function printConfigurationValue(OutputInterface $output, $name, $value, $indent = 0)
|
private function printConfigurationValue(OutputInterface $output, $name, $value, $indent = 0)
|
||||||
{
|
{
|
||||||
if ($indent > 0) {
|
if ($indent > 0 && !$this->quiet) {
|
||||||
$output->write(PHP_EOL);
|
$output->write(PHP_EOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$this->quiet) {
|
||||||
$output->write(str_repeat(' ', $indent * 4) . (is_numeric($name) ? '- ' : $name . ': '));
|
$output->write(str_repeat(' ', $indent * 4) . (is_numeric($name) ? '- ' : $name . ': '));
|
||||||
|
}
|
||||||
|
|
||||||
if (is_array($value)) {
|
if (is_array($value)) {
|
||||||
if (empty($value)) {
|
if (empty($value) && !$this->quiet) {
|
||||||
$output->write('[]');
|
$output->write('[]');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,8 +207,10 @@ class ConfigurationEditor extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (!$this->quiet) {
|
||||||
$output->write(var_export($value));
|
$output->write(var_export($value));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($indent == 0) {
|
if ($indent == 0) {
|
||||||
$output->write(PHP_EOL);
|
$output->write(PHP_EOL);
|
||||||
|
Reference in New Issue
Block a user