Skip to content

Commit 158f644

Browse files
authored
Merge pull request #688 from City-of-Helsinki/dev
Dev to main
2 parents 5169c9e + 6e397fe commit 158f644

File tree

12 files changed

+594
-327
lines changed

12 files changed

+594
-327
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
PHONY :=
22
PROJECT_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
3+
IS_CONTAINER := $(shell test ${CONTAINER_RUNNING} && echo true || echo false)
34

45
# Colors
56
NO_COLOR=\033[0m

composer.lock

Lines changed: 481 additions & 290 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

conf/cmi/editor.editor.full_html.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
module:
88
- ckeditor5
99
_core:
10-
default_config_hash: oCDUwt4GjXQJeBCiJlq5NKEU0d9JP2Kx3QZKMuDAi_g
10+
default_config_hash: i1fLaAzni2rKBDARlCWA1xa79zo_RYF-8oQ3x9wxgfM
1111
format: full_html
1212
editor: ckeditor5
1313
settings:
@@ -151,6 +151,11 @@ settings:
151151
weight: 19
152152
search: '(<a\b[^>]*?)\s+target\s*=\s*("_blank"|_blank)'
153153
replace: $1
154+
-
155+
enabled: true
156+
weight: 20
157+
search: '&nbsp;'
158+
replace: ' '
154159
ckeditor5_sourceEditing:
155160
allowed_tags:
156161
- '<figure tabindex>'

conf/cmi/editor.editor.minimal.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ dependencies:
77
module:
88
- ckeditor5
99
_core:
10-
default_config_hash: 5XykmWxByyrIQ2N9_zHqVQlMtBUy9wc5P9lPrM_g7oQ
10+
default_config_hash: oE8ZPS7LMQvOJv0JDM2AJcGyPAti79fl6vzr3v-GWM0
1111
format: minimal
1212
editor: ckeditor5
1313
settings:
@@ -133,6 +133,11 @@ settings:
133133
weight: 19
134134
search: '(<a\b[^>]*?)\s+target\s*=\s*("_blank"|_blank)'
135135
replace: $1
136+
-
137+
enabled: true
138+
weight: 20
139+
search: '&nbsp;'
140+
replace: ' '
136141
ckeditor5_sourceEditing:
137142
allowed_tags:
138143
- '<p data-chat-trigger>'

conf/cmi/openid_connect.client.tunnistamo.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,33 @@ id: tunnistamo
1010
label: Tunnistamo
1111
plugin: tunnistamo
1212
settings:
13-
client_id: placeholder
14-
client_secret: placeholder
13+
client_id: ''
14+
client_secret: ''
1515
iss_allowed_domains: ''
16-
is_production: 0
16+
prompt:
17+
login: login
1718
auto_login: 0
18-
environment_url: 'https://tunnistamo.test.hel.ninja'
19+
environment_url: ''
1920
client_scopes: 'openid,email'
2021
client_roles: { }
21-
debug_log: false
22+
ad_roles:
23+
-
24+
ad_role: Drupal_Helfi_kaupunkitaso_paakayttajat
25+
roles:
26+
- admin
27+
-
28+
ad_role: Drupal_Helfi_Tyo_ja_yrittäminen_sisallontuottajat_laaja
29+
roles:
30+
- editor
31+
-
32+
ad_role: Drupal_Helfi_Tyo_ja_yrittäminen_sisallontuottajat_suppea
33+
roles:
34+
- content_producer
35+
-
36+
ad_role: Drupal_Helfi_Etusivu_kayttajakyselyt
37+
roles:
38+
- survey_editor
39+
-
40+
ad_role: 947058f4-697e-41bb-baf5-f69b49e5579a
41+
roles:
42+
- super_administrator

conf/cmi/search_api.index.embeddings.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ dependencies:
55
config:
66
- search_api.server.etusivu
77
module:
8+
- helfi_react_search
9+
- helfi_recommendations
810
- helfi_search
11+
- helfi_tpr
912
- node
1013
id: embeddings
1114
name: 'Vector embeddings'
@@ -20,14 +23,10 @@ field_settings:
2023
label: 'Entity type'
2124
property_path: search_api_entity_type
2225
type: string
23-
title:
24-
label: Title
25-
datasource_id: 'entity:node'
26-
property_path: title
26+
label:
27+
label: 'Entity label'
28+
property_path: helfi_entity_label
2729
type: string
28-
dependencies:
29-
module:
30-
- node
3130
url:
3231
label: URI
3332
property_path: search_api_url
@@ -44,16 +43,37 @@ datasource_settings:
4443
languages:
4544
default: true
4645
selected: { }
46+
'entity:tpr_service':
47+
languages:
48+
default: true
49+
selected: { }
50+
'entity:tpr_unit':
51+
languages:
52+
default: true
53+
selected: { }
4754
processor_settings:
4855
add_url: { }
56+
aggregated_field: { }
57+
channels_for_service: { }
58+
custom_value: { }
59+
district_image_absolute_url: { }
4960
entity_status: { }
5061
entity_type: { }
62+
helfi_entity_label: { }
5163
helfi_search_embeddings: { }
64+
language_with_fallback: { }
65+
project_execution_schedule: { }
66+
project_image_absolute_url: { }
67+
project_plan_schedule: { }
68+
rendered_item: { }
69+
scored_reference: { }
70+
scored_reference_parent: { }
71+
units_for_service: { }
5272
tracker_settings:
5373
default:
5474
indexing_order: fifo
5575
options:
56-
cron_limit: 100
76+
cron_limit: 1
5777
delete_on_fail: true
5878
index_directly: false
5979
track_changes_in_references: true

docker/openshift/crons/cron.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
while true
44
do
5-
echo "Running cron: $(date +'%Y-%m-%dT%H:%M:%S%:z')\n"
5+
echo "Running cron: $(date +'%Y-%m-%dT%H:%M:%S%:z')"
66
drush cron
77
# Sleep for 10 minutes.
88
sleep 600

docker/openshift/crons/purge-queue.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
#!/bin/bash
22

3+
source /init.sh
4+
5+
if ! is_drupal_module_enabled "purge"; then
6+
exit 0
7+
fi
8+
39
function has_items {
410
NUM_ITEMS=$(drush p:queue-stats --format=json | jq .number_of_items)
511

docker/openshift/hooks/db-replace/50-sanitize.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ fi
77

88
# Obfuscate user data
99
drush sql:sanitize
10+
# Convert file schemes for Stage file proxy
11+
drush sql-query "UPDATE file_managed SET uri = REPLACE(uri, 'azure://', 'public://');"

public/sites/default/settings.php

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
ini_set('zend.enable_gc', 'Off');
1313
}
1414

15+
$env = getenv('APP_ENV');
1516

1617
if (!function_exists('drupal_get_env')) {
1718
/**
@@ -155,15 +156,15 @@ function drupal_get_env(string|array $variables) : mixed {
155156

156157
// Make sure project name and app env are defined in GitHub actions too.
157158
if ($github_repository = getenv('GITHUB_REPOSITORY')) {
158-
if (!getenv('APP_ENV')) {
159+
if (!$env) {
159160
putenv('APP_ENV=ci');
160161
}
161162

162163
if (!getenv('PROJECT_NAME')) {
163164
putenv('PROJECT_NAME=' . $github_repository);
164165
}
165166
}
166-
$config['helfi_api_base.environment_resolver.settings']['environment_name'] = getenv('APP_ENV');
167+
$config['helfi_api_base.environment_resolver.settings']['environment_name'] = $env;
167168
$config['helfi_api_base.environment_resolver.settings']['project_name'] = getenv('PROJECT_NAME');
168169

169170
if ($varnish_host = getenv('DRUPAL_VARNISH_HOST')) {
@@ -172,7 +173,7 @@ function drupal_get_env(string|array $variables) : mixed {
172173

173174
$varnish_backend = parse_url($drush_options_uri, PHP_URL_HOST);
174175

175-
if (getenv('APP_ENV') === 'local') {
176+
if ($env === 'local') {
176177
// Varnish backend is something like varnish-helfi-kymp.docker.so on
177178
// local env.
178179
$varnish_backend = 'varnish-' . $varnish_backend;
@@ -227,15 +228,6 @@ function drupal_get_env(string|array $variables) : mixed {
227228
}
228229
}
229230
}
230-
$stage_file_proxy_origin = getenv('STAGE_FILE_PROXY_ORIGIN');
231-
$stage_file_proxy_dir = getenv('STAGE_FILE_PROXY_ORIGIN_DIR');
232-
233-
if ($stage_file_proxy_origin || $stage_file_proxy_dir) {
234-
$config['stage_file_proxy.settings']['origin'] = $stage_file_proxy_origin ?: 'https://stplattaprod.blob.core.windows.net';
235-
$config['stage_file_proxy.settings']['origin_dir'] = $stage_file_proxy_dir;
236-
$config['stage_file_proxy.settings']['hotlink'] = FALSE;
237-
$config['stage_file_proxy.settings']['use_imagecache_root'] = FALSE;
238-
}
239231

240232
if ($drupal_pubsub_vault = getenv('DRUPAL_PUBSUB_VAULT')) {
241233
$config['helfi_api_base.api_accounts']['vault'][] = [
@@ -343,7 +335,7 @@ function drupal_get_env(string|array $variables) : mixed {
343335
}
344336

345337
// Supported values: https://github.com/Seldaek/monolog/blob/main/doc/01-usage.md#log-levels.
346-
$default_log_level = getenv('APP_ENV') === 'production' ? 'info' : 'debug';
338+
$default_log_level = $env === 'production' ? 'info' : 'debug';
347339
$settings['helfi_api_base.log_level'] = getenv('LOG_LEVEL') ?: $default_log_level;
348340

349341
// Turn sentry JS error tracking on if SENTRY_DSN_PUBLIC is defined.
@@ -373,7 +365,7 @@ function drupal_get_env(string|array $variables) : mixed {
373365

374366
// E2E test users. We should never do this in production, so adding a failsafe
375367
// in case the environment variable would ever end up in production.
376-
if (getenv('APP_ENV') !== 'production' && $e2e_test_user = getenv('E2E_TEST_USER')) {
368+
if ($env !== 'production' && $e2e_test_user = getenv('E2E_TEST_USER')) {
377369
$e2e_test_user = json_decode($e2e_test_user, TRUE);
378370

379371
// Make sure the user exists in Drupal.
@@ -386,13 +378,31 @@ function drupal_get_env(string|array $variables) : mixed {
386378
]);
387379
}
388380

381+
if ($env !== 'production') {
382+
$stage_file_proxy_origin = getenv('STAGE_FILE_PROXY_ORIGIN');
383+
$stage_file_proxy_dir = getenv('STAGE_FILE_PROXY_ORIGIN_DIR');
384+
385+
// Always default to blob storage if configured.
386+
if ($blob_storage_container = getenv('AZURE_BLOB_STORAGE_CONTAINER')) {
387+
$stage_file_proxy_origin = 'https://stplattaprod.blob.core.windows.net';
388+
// The container name uses the same naming convention across environments.
389+
// Make sure the container name also points to production.
390+
// For example: 'etusivu64e62test' -> 'etusivu64e62prod'.
391+
$stage_file_proxy_dir = str_replace(['test', 'staging'], 'prod', $blob_storage_container);
392+
}
393+
$config['stage_file_proxy.settings']['origin'] = $stage_file_proxy_origin;
394+
$config['stage_file_proxy.settings']['origin_dir'] = $stage_file_proxy_dir;
395+
$config['stage_file_proxy.settings']['hotlink'] = FALSE;
396+
$config['stage_file_proxy.settings']['use_imagecache_root'] = TRUE;
397+
}
398+
389399
// Environment specific overrides.
390400
if (file_exists(__DIR__ . '/all.settings.php')) {
391401
// phpcs:ignore
392402
include_once __DIR__ . '/all.settings.php'; // NOSONAR
393403
}
394404

395-
if ($env = getenv('APP_ENV')) {
405+
if ($env) {
396406
if (file_exists(__DIR__ . '/' . $env . '.settings.php')) {
397407
// phpcs:ignore
398408
include_once __DIR__ . '/' . $env . '.settings.php'; // NOSONAR

0 commit comments

Comments
 (0)