Skip to content
Snippets Groups Projects
Commit 1d6d3250 authored by jurgenhaas's avatar jurgenhaas
Browse files

Optimize settings for LAKEDROPS_BUILD_NG

Updating config also updates Drupal environment if available
parent b1655295
No related branches found
No related tags found
No related merge requests found
......@@ -173,26 +173,6 @@ class Handler extends BaseHandler {
$options['projectport'] = ':' . $options['traefik']['port'];
}
// Update config for production build.
if (getenv('LAKEDROPS_BUILD_NG') === 'yes' && $this->getPackage('lakedrops/drupal-environment')) {
$handler = new DrupalEnvironment($this->composer, $this->io);
$config = $handler->getConfig();
$options['drupal'] += [
'live' => $config->readValue('live'),
];
$root = '/drupal/' . getenv('CI_PROJECT_ID') . '/' . getenv('CI_COMMIT_BRANCH');
$options['projectroot'] = $root . '/app';
$options['projectrootdb'] = $root . '/db';
$options['projectrootfiles'] = $root . '/files';
$options['projectname'] = getenv('CI_PROJECT_ID') . '-' . getenv('CI_COMMIT_BRANCH');
$options['projectdomain'] = $config->readValue('domain');
$options['projectprotocol'] = 'https';
$options['projectport'] = '';
$options['extradomains'] = $config->readValue('aliases');
$options['traefik']['usessl'] = 1;
$options['traefik']['ports'] = 443;
}
return $options;
}
......@@ -218,6 +198,38 @@ class Handler extends BaseHandler {
$this->init();
// Configure Drupal environment if avaiable.
if ($this->getPackage('lakedrops/drupal-environment')) {
$handler = new DrupalEnvironment($this->composer, $this->io);
$handler->setupLakeDropsProject();
// Update config for production build.
if (getenv('LAKEDROPS_BUILD_NG') === 'yes') {
$config = $handler->getConfig();
$root = '/drupal/' . getenv('CI_PROJECT_ID') . '/' . getenv('CI_COMMIT_BRANCH');
$drupal = $this->config->readValue('drupal');
$drupal['live'] = $config->readValue('live');
$traefik = $this->config->readValue('traefik');
$traefik['usessl'] = 1;
$traefik['ports'] = 443;
$overwrite = [
'drupal' => $drupal,
'traefik' => $traefik,
'projectroot' => $root . '/app',
'projectrootdb' => $root . '/db',
'projectrootfiles' => $root . '/files',
'projectname' => getenv('CI_PROJECT_ID') . '-' . getenv('CI_COMMIT_BRANCH'),
'projectdomain' => $config->readValue('domain'),
'projectprotocol' => 'https',
'projectport' => '',
'extradomains' => $config->readValue('aliases'),
];
foreach ($overwrite as $key => $value) {
$this->config->setValue($key, $value, FALSE);
}
}
}
$fs = new Filesystem();
$installationManager = $this->composer->getInstallationManager();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment