diff --git a/.env b/.env index c8ead6f1d..21a4054d1 100644 --- a/.env +++ b/.env @@ -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 ### @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index 33183e962..e2e1809de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index dcd91eb93..379c63fab 100644 --- a/README.md +++ b/README.md @@ -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 . **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)? @@ -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 diff --git a/UPGRADE.md b/UPGRADE.md index ab622b548..defd100b8 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -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/`. @@ -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 @@ -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 diff --git a/config/packages/framework.yaml b/config/packages/framework.yaml index 2ef21239f..10cd649e5 100644 --- a/config/packages/framework.yaml +++ b/config/packages/framework.yaml @@ -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: diff --git a/config/services.yaml b/config/services.yaml index fc1f0b310..92b2c2d39 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -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: @@ -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] diff --git a/src/Service/KeyVaultService.php b/src/Service/KeyVaultService.php index cf3ee3a23..d78f3aa3d 100644 --- a/src/Service/KeyVaultService.php +++ b/src/Service/KeyVaultService.php @@ -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( diff --git a/tests/Utils/ValidationUtilsTest.php b/tests/Utils/ValidationUtilsTest.php index ec2c45f0c..89a195684 100644 --- a/tests/Utils/ValidationUtilsTest.php +++ b/tests/Utils/ValidationUtilsTest.php @@ -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'; @@ -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';