provision.sh: Update trusted host patterns
This commit is contained in:
parent
18c4957e30
commit
a4b8f09a8a
7 changed files with 11 additions and 5 deletions
|
|
@ -4,4 +4,5 @@
|
|||
# allow the following files:
|
||||
!conf/*
|
||||
!scripts/*
|
||||
!patch/*
|
||||
!patch/*
|
||||
!wisskiutils/*
|
||||
|
|
@ -91,12 +91,13 @@ VOLUME /var/www/data
|
|||
|
||||
# Add and configure the entrypoint
|
||||
ADD scripts/entrypoint.sh /entrypoint.sh
|
||||
ADD scripts/create_adapter.php /create_adapter.php
|
||||
|
||||
ENTRYPOINT [ "/entrypoint.sh" ]
|
||||
CMD ["apache2-foreground"]
|
||||
|
||||
# Add the provision script
|
||||
# Add the provision script and WissKI utils
|
||||
ADD scripts/provision_container.sh /provision_container.sh
|
||||
ADD wisskiutils/ /wisskiutils
|
||||
|
||||
# Add the user_shell.sh
|
||||
ADD scripts/user_shell.sh /user_shell.sh
|
||||
|
|
|
|||
|
|
@ -130,7 +130,11 @@ drush pm-enable --yes wisski_core wisski_linkblock wisski_pathbuilder wisski_ada
|
|||
drupal_sites_permission_workaround
|
||||
|
||||
log_info " => Setting up WissKI Salz Adapter"
|
||||
drush php:script /create_adapter.php "$INSTANCE_DOMAIN" "$GRAPHDB_REPO" "$GRAPHDB_HEADER"
|
||||
drush php:script /wisskiutils/create_adapter.php "$INSTANCE_DOMAIN" "$GRAPHDB_REPO" "$GRAPHDB_HEADER"
|
||||
|
||||
log_info " => Updating TRUSTED_HOST_PATTERNS in settings.php"
|
||||
|
||||
/bin/bash /wisskiutils/set_trusted_host.sh
|
||||
|
||||
log_info " => Provisioning is now complete. "
|
||||
log_ok "Your installation details are as follows:"
|
||||
|
|
|
|||
13
distillery/resources/compose/barrel/wisskiutils/set_trusted_host.sh
Executable file
13
distillery/resources/compose/barrel/wisskiutils/set_trusted_host.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This utility script can be used to configure the trusted host settings inside of settings.php.
|
||||
# It doesn't take care of corner cases and should only be used when needed.
|
||||
|
||||
INSTANCE_DOMAIN="$(hostname -f)"
|
||||
INSTANCE_DOMAIN="${INSTANCE_DOMAIN%.wisski}"
|
||||
|
||||
TRUSTED_HOST_PATTERN="${INSTANCE_DOMAIN//\./\\\\.}"
|
||||
TRUSTED_HOST_PATTERNS='["'$TRUSTED_HOST_PATTERN'"]'
|
||||
|
||||
echo "Setting 'trusted_host_patterns' to $TRUSTED_HOST_PATTERNS"
|
||||
bash /wisskiutils/settings_php_set.sh 'trusted_host_patterns' "$TRUSTED_HOST_PATTERNS"
|
||||
17
distillery/resources/compose/barrel/wisskiutils/settings_php_get.sh
Executable file
17
distillery/resources/compose/barrel/wisskiutils/settings_php_get.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
|
||||
# settings_php_get.sh name
|
||||
# Gets the 'settings_php_get.php' setting 'name' as json-encoded value, or null when it does not exist.
|
||||
|
||||
NAME=$1
|
||||
|
||||
if [ -z "$NAME" ]; then
|
||||
echo "Usage: get_settings_setting.sh NAME"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
echo "$NAME" | drush php:eval '
|
||||
use \Drupal\Core\Site\Settings;
|
||||
$name=trim(file_get_contents("php://stdin"));
|
||||
echo json_encode(Settings::get($name));
|
||||
';
|
||||
56
distillery/resources/compose/barrel/wisskiutils/settings_php_set.sh
Executable file
56
distillery/resources/compose/barrel/wisskiutils/settings_php_set.sh
Executable file
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
|
||||
# settings_php_set.sh name value
|
||||
# Sets the 'settings.php' setting 'name' to 'value'.
|
||||
# Value must be json-encoded.
|
||||
|
||||
NAME=$1
|
||||
VALUE=$2
|
||||
|
||||
if [ -z "$NAME" ]; then
|
||||
echo "Usage: settings_php_set.sh NAME VALUE"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
if [ -z "$VALUE" ]; then
|
||||
echo "Usage: settings_php_set.sh NAME VALUE"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
cd /var/www/data/project
|
||||
chmod u+w web/sites/default/settings.php
|
||||
|
||||
(echo "$NAME"; echo "$VALUE" ) | drush php:eval '
|
||||
include_once DRUPAL_ROOT . "/core/includes/install.inc";
|
||||
|
||||
// read NAME and VALUE from STDIN
|
||||
$content=file_get_contents("php://stdin");
|
||||
$newline=strpos($content, "\n");
|
||||
$name=trim(substr($content, 0, $newline));
|
||||
$jvalue=trim(substr($content, $newline + 1));
|
||||
|
||||
// decode json values
|
||||
$value = @json_decode($jvalue);
|
||||
if ($data === null && json_last_error() !== JSON_ERROR_NONE) {
|
||||
echo "Invalid JSON, cannot update settings.php. \n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// make parameters to drush_rewrite_settings
|
||||
$settings["settings"][$name] = (object)[
|
||||
"value" => $value,
|
||||
"required" => TRUE,
|
||||
];
|
||||
|
||||
// find the actual settings.php file to rewrite
|
||||
$filename = DRUPAL_ROOT . "/" . \Drupal::service("site.path") . "/settings.php";
|
||||
drupal_rewrite_settings($settings, $filename);
|
||||
|
||||
echo "Wrote " . $filename . "\n";
|
||||
return 0;
|
||||
';
|
||||
EXIT=$?
|
||||
|
||||
chmod u-w web/sites/default/settings.php
|
||||
|
||||
exit $?
|
||||
Loading…
Add table
Add a link
Reference in a new issue