Skip to content

Commit

Permalink
Merge pull request #440 from City-of-Helsinki/update-configuration
Browse files Browse the repository at this point in the history
Automatic update
  • Loading branch information
khalima authored Apr 20, 2023
2 parents 4ca2355 + 203c9e3 commit 05607d3
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 34 deletions.
54 changes: 29 additions & 25 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions conf/cmi/core.extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module:
admin_toolbar: 0
admin_toolbar_tools: 0
allowed_formats: 0
basic_auth: 0
block: 0
breakpoint: 0
ckeditor: 0
Expand Down
23 changes: 23 additions & 0 deletions conf/cmi/rest.resource.entity.node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
uuid: 3f4ad863-f17d-4edf-9908-31a1ccdfc159
langcode: en
status: true
dependencies:
module:
- basic_auth
- hal
- node
_core:
default_config_hash: t_jfECmZhJqBOJuSOFn87EOi_TWi-_fRYTuJgd19vgg
id: entity.node
plugin_id: 'entity:node'
granularity: resource
configuration:
methods:
- GET
- POST
- PATCH
- DELETE
formats:
- hal_json
authentication:
- basic_auth
4 changes: 4 additions & 0 deletions conf/cmi/rest.resource.helfi_debug_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ langcode: en
status: true
dependencies:
module:
- basic_auth
- helfi_api_base
- serialization
- user
id: helfi_debug_data
plugin_id: helfi_debug_data
Expand All @@ -14,3 +17,4 @@ configuration:
- json
authentication:
- cookie
- basic_auth
4 changes: 4 additions & 0 deletions conf/cmi/rest.resource.helfi_debug_package_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ langcode: en
status: true
dependencies:
module:
- basic_auth
- helfi_api_base
- serialization
- user
id: helfi_debug_package_version
plugin_id: helfi_debug_package_version
Expand All @@ -14,3 +17,4 @@ configuration:
- json
authentication:
- cookie
- basic_auth
28 changes: 26 additions & 2 deletions docker/openshift/entrypoints/20-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,44 @@ if [ ! -n "$OPENSHIFT_BUILD_NAME" ]; then
exit 1
fi

function get_deploy_id {
echo $(drush state:get deploy_id)
}

# Generate twig caches.
if [ ! -d "/tmp/twig" ]; then
drush twig:compile || true
fi

# Attempt to set deploy ID in case this is the first deploy.
if [[ -z "$(get_deploy_id)" ]]; then
drush state:set deploy_id $OPENSHIFT_BUILD_NAME
fi

# Exit early if deploy ID is still not set. This usually means either Redis or
# something else is down.
if [[ -z "$(get_deploy_id)" ]]; then
echo "Could not fetch deploy ID. Something is probably wrong. Exiting early."
exit 1
fi

# This script is run every time a container is spawned and certain environments might
# start more than one Drupal container. This is used to make sure we run deploy
# tasks only once per deploy.
if [ "$(drush state:get deploy_id)" != "$OPENSHIFT_BUILD_NAME" ]; then
if [ "$(get_deploy_id)" != "$OPENSHIFT_BUILD_NAME" ]; then
drush state:set deploy_id $OPENSHIFT_BUILD_NAME
# Put site in maintenance mode during deploy
# Put site in maintenance mode
drush state:set system.maintenance_mode 1 --input-format=integer
# Run helfi specific pre-deploy tasks. Allow this to fail in case
# the environment is not using the 'helfi_api_base' module.
# @see https://github.com/City-of-Helsinki/drupal-module-helfi-api-base
drush helfi:pre-deploy || true
# Run maintenance tasks (config import, database updates etc)
drush deploy
# Run helfi specific post deploy tasks. Allow this to fail in case
# the environment is not using the 'helfi_api_base' module.
# @see https://github.com/City-of-Helsinki/drupal-module-helfi-api-base
drush helfi:post-deploy || true
# Disable maintenance mode
drush state:set system.maintenance_mode 0 --input-format=integer
fi
17 changes: 10 additions & 7 deletions public/sites/default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,16 @@
}
$routes[] = 'http://127.0.0.1';

if ($drush_options_uri = getenv('DRUSH_OPTIONS_URI')) {
$routes[] = $drush_options_uri;
}

foreach ($routes as $route) {
$host = parse_url($route, PHP_URL_HOST);
$trusted_host = str_replace('.', '\.', $host);
$settings['trusted_host_patterns'][] = '^' . $trusted_host . '$';
}

$drush_options_uri = getenv('DRUSH_OPTIONS_URI');

if ($drush_options_uri && !in_array($drush_options_uri, $routes)) {
$host = str_replace('.', '\.', parse_url($drush_options_uri)['host']);
$settings['trusted_host_patterns'][] = '^' . $host . '$';
}

$settings['config_sync_directory'] = '../conf/cmi';
$settings['file_public_path'] = getenv('DRUPAL_FILES_PUBLIC') ?: 'sites/default/files';
$settings['file_private_path'] = getenv('DRUPAL_FILES_PRIVATE');
Expand Down Expand Up @@ -171,6 +168,12 @@
$config['stage_file_proxy.settings']['use_imagecache_root'] = FALSE;
}

// Map API accounts. The value should be a base64 encoded JSON string.
// @see https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/blob/main/documentation/api-accounts.md.
if ($api_accounts = getenv('DRUPAL_API_ACCOUNTS')) {
$config['helfi_api_base.api_accounts']['accounts'] = json_decode(base64_decode($api_accounts), TRUE);
}

// Override session suffix when present.
if ($session_suffix = getenv('DRUPAL_SESSION_SUFFIX')) {
$config['helfi_proxy.settings']['session_suffix'] = $session_suffix;
Expand Down

0 comments on commit 05607d3

Please sign in to comment.