Skip to content

Commit

Permalink
Set the Drupal install profile from an env var with a sensible defaul…
Browse files Browse the repository at this point in the history
…t. Also set file permissions to 444 for security. (#12)
  • Loading branch information
pingers authored Sep 5, 2017
1 parent 3f1de63 commit 017dcaa
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public function createSettingsFile()
"\$settings['shepherd_site_id'] = getenv('SHEPHERD_SITE_ID');\n" .
"\$settings['shepherd_url'] = getenv('SHEPHERD_URL');\n" .
"\$settings['shepherd_token'] = getenv('SHEPHERD_TOKEN_FILE') ? file_get_contents(getenv('SHEPHERD_TOKEN_FILE')) : getenv('SHEPHERD_TOKEN');\n\n" .
"\$settings['install_profile'] = getenv('SHEPHERD_INSTALL_PROFILE') ?: 'standard';\n" .
"if (getenv('REDIS_ENABLED')) {\n" .
" \$settings['redis.connection']['interface'] = 'PhpRedis';\n" .
" \$settings['redis.connection']['host'] = getenv('REDIS_HOST') ?: 'redis';\n" .
Expand Down Expand Up @@ -168,6 +169,7 @@ public function createSettingsFile()
$shepherdSettings,
FILE_APPEND
);
$this->filesystem->chmod($root . '/sites/default/settings.php', 0444);
}
}

Expand All @@ -180,7 +182,7 @@ public function createServicesFile()

if (!$this->filesystem->exists($root . '/sites/default/services.yml') && $this->filesystem->exists($root . '/sites/default/default.services.yml')) {
$this->filesystem->copy($root . '/sites/default/default.services.yml', $root . '/sites/default/services.yml');
$this->filesystem->chmod($root . '/sites/default/services.yml', 0666);
$this->filesystem->chmod($root . '/sites/default/services.yml', 0444);
}
}

Expand Down

0 comments on commit 017dcaa

Please sign in to comment.