Skip to content

Commit 44136b3

Browse files
authored
Merge pull request #339 from os2display/feature/6293-align-environment-variable-names
Align environment variable names
2 parents 8a84862 + 0dd9741 commit 44136b3

8 files changed

Lines changed: 50 additions & 23 deletions

File tree

.env

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,10 @@ REDIS_CACHE_DSN=redis://redis:6379/0
6262
###< redis ###
6363

6464
###> App ###
65-
APP_DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
66-
APP_ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
67-
APP_KEY_VAULT_SOURCE=ENVIRONMENT
68-
APP_KEY_VAULT_JSON="{}"
69-
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
65+
DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
66+
ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
67+
KEY_VAULT_SOURCE=ENVIRONMENT
68+
KEY_VAULT_JSON="{}"
7069
TRACK_SCREEN_INFO=false
7170
TRACK_SCREEN_INFO_UPDATE_INTERVAL_SECONDS=300
7271
###< App ###
@@ -108,6 +107,10 @@ CALENDAR_API_FEED_SOURCE_DATE_TIMEZONE=
108107
CALENDAR_API_FEED_SOURCE_CACHE_EXPIRE_SECONDS=300
109108
###< Calendar Api Feed Source ###
110109

110+
###> Event Database Api V2 Feed Type ###
111+
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
112+
###< Event Database Api V2 Feed Type ###
113+
111114
###> Admin configuration ###
112115
ADMIN_REJSEPLANEN_APIKEY=
113116
ADMIN_SHOW_SCREEN_STATUS=false

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ All notable changes to this project will be documented in this file.
2626
- Refactored screen layout commands.
2727
- Moved list components (search and checkboxes) around.
2828
- Replaced lodash functions with native ones.
29+
- Aligned environment variable names.
2930
- Aligned with v. 2.6.0.
3031

3132
### NB! Prior to 3.x the project was split into separate repositories

README.md

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,22 +391,23 @@ Configuration of the project should be added to `.env.local`. Default values are
391391

392392
```dotenv
393393
###> App ###
394-
APP_ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
395-
APP_KEY_VAULT_SOURCE=ENVIRONMENT
396-
APP_KEY_VAULT_JSON="{}"
397-
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
394+
DEFAULT_DATE_FORMAT='Y-m-d\TH:i:s.v\Z'
395+
ACTIVATION_CODE_EXPIRE_INTERVAL=P2D
396+
KEY_VAULT_SOURCE=ENVIRONMENT
397+
KEY_VAULT_JSON="{}"
398398
TRACK_SCREEN_INFO=false
399399
TRACK_SCREEN_INFO_UPDATE_INTERVAL_SECONDS=300
400400
###< App ###
401401
```
402402

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

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

527+
#### Event Database Api V2 Feed Type
528+
529+
```dotenv
530+
###> Event Database Api V2 Feed Source ###
531+
EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS=300
532+
###< Event Database Api V2 Feed Source ###
533+
```
534+
535+
- EVENTDATABASE_API_V2_CACHE_EXPIRE_SECONDS: What should the expiration be for cache entries in
536+
EventDatabaseApiV2FeedType?
537+
526538
## Rest API & Relationships
527539

528540
To avoid embedding all relations in REST representations but still allow the clients to minimize the amount of API calls

UPGRADE.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ Because of these changes, it will be necessary to adjust the server setup to mat
1717

1818
### Upgrade steps
1919

20-
#### 0 - Convert external templates to custom templates
20+
#### 0.1 - Upgrade the API to the latest version of 2.x
21+
22+
#### 0.2 - Checkout the API to 3.x
23+
24+
#### 1 - Convert external templates to custom templates
2125

2226
Instead of loading javascript for templates from possibly external urls we have made the change to only include
2327
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
2832

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

31-
#### 1 - Upgrade the API to the latest version of 2.x
32-
3335
#### 2 - Configure the following environment variables in `.env.local`
3436

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

67+
#### 2.1 - Rename environment variables
68+
69+
Rename the following .env variables in `.env.local`:
70+
71+
- From `APP_DEFAULT_DATE_FORMAT` to `DEFAULT_DATE_FORMAT`
72+
- From `APP_ACTIVATION_CODE_EXPIRE_INTERVAL` to `ACTIVATION_CODE_EXPIRE_INTERVAL`
73+
- From `APP_KEY_VAULT_SOURCE` to `KEY_VAULT_SOURCE`
74+
- From `APP_KEY_VAULT_JSON` to `KEY_VAULT_JSON`
75+
6576
#### 3 - Run doctrine migrate
6677

6778
```shell

config/packages/framework.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ framework:
2222
# https://symfony.com/doc/current/serializer.html#serializer-context
2323
serializer:
2424
default_context:
25-
!php/const Symfony\Component\Serializer\Normalizer\DateTimeNormalizer::FORMAT_KEY: '%env(APP_DEFAULT_DATE_FORMAT)%'
25+
!php/const Symfony\Component\Serializer\Normalizer\DateTimeNormalizer::FORMAT_KEY: '%env(DEFAULT_DATE_FORMAT)%'
2626

2727
when@test:
2828
framework:

config/services.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ services:
8888

8989
App\Service\KeyVaultService:
9090
arguments:
91-
$keyVaultSource: '%env(string:APP_KEY_VAULT_SOURCE)%'
92-
$keyVaultArray: '%env(json:APP_KEY_VAULT_JSON)%'
91+
$keyVaultSource: '%env(string:KEY_VAULT_SOURCE)%'
92+
$keyVaultArray: '%env(json:KEY_VAULT_JSON)%'
9393

9494
App\Service\UserService:
9595
arguments:
9696
$hashSalt: '%env(EXTERNAL_OIDC_HASH_SALT)%'
97-
$codeExpireInterval: '%env(string:APP_ACTIVATION_CODE_EXPIRE_INTERVAL)%'
97+
$codeExpireInterval: '%env(string:ACTIVATION_CODE_EXPIRE_INTERVAL)%'
9898

9999
App\Security\EventSubscriber\JwtTokenRefreshedSubscriber:
100100
arguments:
@@ -151,7 +151,7 @@ services:
151151

152152
App\Utils\ValidationUtils:
153153
arguments:
154-
$defaultDateFormat: '%env(string:APP_DEFAULT_DATE_FORMAT)%'
154+
$defaultDateFormat: '%env(string:DEFAULT_DATE_FORMAT)%'
155155

156156
App\EventListener\FeedDoctrineEventListener:
157157
tags: [doctrine.orm.entity_listener]

src/Service/KeyVaultService.php

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

77
readonly class KeyVaultService
88
{
9-
// APP_KEY_VAULT_SOURCE (set in environment/.env) options:
9+
// KEY_VAULT_SOURCE (set in environment/.env) options:
1010
public const string ENVIRONMENT = 'ENVIRONMENT';
1111

1212
public function __construct(

tests/Utils/ValidationUtilsTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ protected function setUp(): void
2222

2323
public function testValidateDate(): void
2424
{
25-
$format = $_ENV['APP_DEFAULT_DATE_FORMAT'];
25+
$format = $_ENV['DEFAULT_DATE_FORMAT'];
2626
$this->assertNotEmpty($format);
2727

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

3535
public function testInvalidValidateDate(): void
3636
{
37-
$format = $_ENV['APP_DEFAULT_DATE_FORMAT'];
37+
$format = $_ENV['DEFAULT_DATE_FORMAT'];
3838
$this->assertNotEmpty($format);
3939

4040
$dateStr = '2021-09-42T17:00:01Z';

0 commit comments

Comments
 (0)