Skip to content

Commit

Permalink
TASK: Apply adjustments from review
Browse files Browse the repository at this point in the history
- Store configuration in Settings.Database.yaml and Settings.Imagehanding.yaml
- Use best available imagine driver by default (last one of
- Use 127.0.0.1 by default as database hostname
  • Loading branch information
mficzel committed Nov 14, 2021
1 parent e86ce69 commit 421999e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
20 changes: 11 additions & 9 deletions Neos.CliSetup/Classes/Command/SetupCommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ public function databaseCommand(?string $driver = null, ?string $host = null, ?s

if (is_null($host)) {
$host = $this->output->ask(
sprintf('Host (<info>%s</info>): ', $this->persistenceConfiguration['host']),
$this->persistenceConfiguration['host']
sprintf('Host (<info>%s</info>): ', $this->persistenceConfiguration['host'] ?? '127.0.0.1'),
$this->persistenceConfiguration['host'] ?? '127.0.0.1'
);
}

Expand Down Expand Up @@ -125,7 +125,7 @@ public function databaseCommand(?string $driver = null, ?string $host = null, ?s
$this->quit(1);
}

$filename = $this->getSettingsFilename();
$filename = $this->getSettingsFilename('Settings.Database.yaml');

$this->outputLine();
$this->output($this->writeSettings($filename, 'Neos.Flow.persistence.backendOptions',$persistenceConfiguration));
Expand All @@ -147,26 +147,28 @@ public function imageHandlerCommand(string $driver = null): void

if (is_null($driver)) {
$driver = $this->output->select(
sprintf('Select Image Handler (<info>%s</info>): ', $this->imagineDriver),
sprintf('Select Image Handler (<info>%s</info>): ', array_key_last($availableImageHandlers)),
$availableImageHandlers,
$this->imagineDriver
array_key_last($availableImageHandlers)
);
}

$filename = $this->getSettingsFilename();
$filename = $this->getSettingsFilename('Settings.Imagehandling.yaml');
$this->outputLine();
$this->output($this->writeSettings($filename, 'Neos.Imagine.driver', $driver));
$this->outputLine();
$this->outputLine(sprintf("The new image handler setting were written to file <info>%s</info>", $filename));
}

/**
* Get the full path for the given settings filename in the current application context
*
* @param string $filename The filename for the settings file
* @return string
*/
protected function getSettingsFilename(): string
protected function getSettingsFilename(string $filename): string
{
$filename = 'Configuration/' . $this->flowContext . '/Settings.yaml';
return $filename;
return 'Configuration/' . $this->flowContext . '/' . $filename;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Neos.CliSetup/Configuration/Settings.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Neos:
CliSetup:
#
# Imgine drivers currently available
# Imagine drivers that are supported
#
supportedImageHandlers:
'Gd': 'GD Library - generally slow'
'Gd': 'GD Library - generally slow, not recommended in production'
'Gmagick': 'Gmagick php module'
'Imagick': 'ImageMagick php module'
'Vips': 'Vips php module - fast and memory efficient, needs rokka/imagine-vips'
Expand All @@ -16,7 +16,7 @@ Neos:
'gif': 'resource://Neos.Neos/Private/Installer/TestImages/Test.gif'
'png': 'resource://Neos.Neos/Private/Installer/TestImages/Test.png'
#
# The drivers that are supported via migrations
# The database drivers that are supported by migrations
#
supportedDatabaseDrivers:
'pdo_mysql': 'MySQL/MariaDB via PDO'
Expand Down

0 comments on commit 421999e

Please sign in to comment.