Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ REDIS_CACHE_DSN=redis://redis:6379/0
###< redis ###

###> App ###
APP_DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
APP_ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
APP_KEY_VAULT_SOURCE=ENVIRONMENT
APP_KEY_VAULT_JSON="{}"
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
KEY_VAULT_SOURCE=ENVIRONMENT
KEY_VAULT_JSON="{}"
TRACK_SCREEN_INFO=false
TRACK_SCREEN_INFO_UPDATE_INTERVAL_SECONDS=300
###< App ###
Expand Down Expand Up @@ -108,6 +107,10 @@ CALENDAR_API_FEED_SOURCE_DATE_TIMEZONE=
CALENDAR_API_FEED_SOURCE_CACHE_EXPIRE_SECONDS=300
###< Calendar Api Feed Source ###

###> Event Database Api V2 Feed Type ###
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
###< Event Database Api V2 Feed Type ###

###> Admin configuration ###
ADMIN_REJSEPLANEN_APIKEY=
ADMIN_SHOW_SCREEN_STATUS=false
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file.
- Refactored screen layout commands.
- Moved list components (search and checkboxes) around.
- Replaced lodash functions with native ones.
- Aligned environment variable names.
- Aligned with v. 2.6.0.

### NB! Prior to 3.x the project was split into separate repositories
Expand Down
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,22 +391,23 @@ Configuration of the project should be added to `.env.local`. Default values are

```dotenv
###> App ###
APP_ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
APP_KEY_VAULT_SOURCE=ENVIRONMENT
APP_KEY_VAULT_JSON="{}"
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
KEY_VAULT_SOURCE=ENVIRONMENT
KEY_VAULT_JSON="{}"
TRACK_SCREEN_INFO=false
TRACK_SCREEN_INFO_UPDATE_INTERVAL_SECONDS=300
###< App ###
```

- APP_ACTIVATION_CODE_EXPIRE_INTERVAL: Specifies how long an external user activation code should live.
- DEFAULT_DATE_FORMAT: The default format of serialized dates.
- ACTIVATION_CODE_EXPIRE_INTERVAL: Specifies how long an external user activation code should live.
The format of the interval should follow <https://www.php.net/manual/en/dateinterval.construct.php>.

**Default**: 2 days.
- APP_KEY_VAULT_SOURCE: Source of key-value pair for `src/Service/KeyVaultService`. Atm. "ENVIRONMENT" is the only
- KEY_VAULT_SOURCE: Source of key-value pair for `src/Service/KeyVaultService`. Atm. "ENVIRONMENT" is the only
option.
- APP_KEY_VAULT_JSON: A json object formatted as a string. Contains key-value pairs that can be accessed by through
- KEY_VAULT_JSON: A json object formatted as a string. Contains key-value pairs that can be accessed by through
`src/Service/KeyVaultService`.
- EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS: What should the expire be for cache entries in EventDatabaseApiV2FeedType?
- TRACK_SCREEN_INFO: Should screen info be tracked (true|false)?
Expand Down Expand Up @@ -523,6 +524,17 @@ CLIENT_DEBUG=false
- See `docs/configuration/openid-connect.md` for configuration of OpenID Connect.
- See `docs/configuration/calendar-api-feed.md` for configuration of CalenderApiFeedType.

#### Event Database Api V2 Feed Type

```dotenv
###> Event Database Api V2 Feed Source ###
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
###< Event Database Api V2 Feed Source ###
```

- EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS: What should the expiration be for cache entries in
EventDatabaseApiV2FeedType?

## Rest API & Relationships

To avoid embedding all relations in REST representations but still allow the clients to minimize the amount of API calls
Expand Down
17 changes: 14 additions & 3 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ Because of these changes, it will be necessary to adjust the server setup to mat

### Upgrade steps

#### 0 - Convert external templates to custom templates
#### 0.1 - Upgrade the API to the latest version of 2.x

#### 0.2 - Checkout the API to 3.x

#### 1 - Convert external templates to custom templates

Instead of loading javascript for templates from possibly external urls we have made the change to only include
templates that are a part of the code. Standard templates are now located in `assets/shared/templates/`.
Expand All @@ -28,8 +32,6 @@ Custom templates are documented in the [README.md#custom-templates](README.md#cu

The important thing is that the `id` of the template should remain the same when converted to a custom template.

#### 1 - Upgrade the API to the latest version of 2.x

#### 2 - Configure the following environment variables in `.env.local`

```dotenv
Expand Down Expand Up @@ -62,6 +64,15 @@ docker compose exec phpfpm bin/console app:utils:convert-config-json-to-env --ty
docker compose exec phpfpm bin/console app:utils:convert-config-json-to-env --type=client path/to/client/config.json
```

#### 2.1 - Rename environment variables

Rename the following .env variables in `.env.local`:

- From `APP_DEFAULT_DATE_FORMAT` to `DEFAULT_DATE_FORMAT`
- From `APP_ACTIVATION_CODE_EXPIRE_INTERVAL` to `ACTIVATION_CODE_EXPIRE_INTERVAL`
- From `APP_KEY_VAULT_SOURCE` to `KEY_VAULT_SOURCE`
- From `APP_KEY_VAULT_JSON` to `KEY_VAULT_JSON`

#### 3 - Run doctrine migrate

```shell
Expand Down
2 changes: 1 addition & 1 deletion config/packages/framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ framework:
# https://symfony.com/doc/current/serializer.html#serializer-context
serializer:
default_context:
!php/const Symfony\Component\Serializer\Normalizer\DateTimeNormalizer::FORMAT_KEY: '%env(APP_DEFAULT_DATE_FORMAT)%'
!php/const Symfony\Component\Serializer\Normalizer\DateTimeNormalizer::FORMAT_KEY: '%env(DEFAULT_DATE_FORMAT)%'

when@test:
framework:
Expand Down
8 changes: 4 additions & 4 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ services:

App\Service\KeyVaultService:
arguments:
$keyVaultSource: '%env(string:APP_KEY_VAULT_SOURCE)%'
$keyVaultArray: '%env(json:APP_KEY_VAULT_JSON)%'
$keyVaultSource: '%env(string:KEY_VAULT_SOURCE)%'
$keyVaultArray: '%env(json:KEY_VAULT_JSON)%'

App\Service\UserService:
arguments:
$hashSalt: '%env(EXTERNAL_OIDC_HASH_SALT)%'
$codeExpireInterval: '%env(string:APP_ACTIVATION_CODE_EXPIRE_INTERVAL)%'
$codeExpireInterval: '%env(string:ACTIVATION_CODE_EXPIRE_INTERVAL)%'

App\Security\EventSubscriber\JwtTokenRefreshedSubscriber:
arguments:
Expand Down Expand Up @@ -151,7 +151,7 @@ services:

App\Utils\ValidationUtils:
arguments:
$defaultDateFormat: '%env(string:APP_DEFAULT_DATE_FORMAT)%'
$defaultDateFormat: '%env(string:DEFAULT_DATE_FORMAT)%'

App\EventListener\FeedDoctrineEventListener:
tags: [doctrine.orm.entity_listener]
Expand Down
2 changes: 1 addition & 1 deletion src/Service/KeyVaultService.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

readonly class KeyVaultService
{
// APP_KEY_VAULT_SOURCE (set in environment/.env) options:
// KEY_VAULT_SOURCE (set in environment/.env) options:
public const string ENVIRONMENT = 'ENVIRONMENT';

public function __construct(
Expand Down
4 changes: 2 additions & 2 deletions tests/Utils/ValidationUtilsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ protected function setUp(): void

public function testValidateDate(): void
{
$format = $_ENV['APP_DEFAULT_DATE_FORMAT'];
$format = $_ENV['DEFAULT_DATE_FORMAT'];
$this->assertNotEmpty($format);

$dateStr = '2021-09-22T17:00:01.000Z';
Expand All @@ -34,7 +34,7 @@ public function testValidateDate(): void

public function testInvalidValidateDate(): void
{
$format = $_ENV['APP_DEFAULT_DATE_FORMAT'];
$format = $_ENV['DEFAULT_DATE_FORMAT'];
$this->assertNotEmpty($format);

$dateStr = '2021-09-42T17:00:01Z';
Expand Down
Loading