Skip to content

Commit

Permalink
Replaced configuration, documentation WIP.
Browse files Browse the repository at this point in the history
  • Loading branch information
Syndesi committed Aug 11, 2023
1 parent c7fb921 commit 9b04a3e
Show file tree
Hide file tree
Showing 20 changed files with 224 additions and 242 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Reword application configuration, via internal Symfony bundle.
- Switch datetime format from temporary string type to datetime.
- Change default JSON encoding options.
- Replaced configuration, documentation WIP.

## 0.0.19 - 2023-08-10
### Added
Expand Down
1 change: 0 additions & 1 deletion config/custom-parameters.yaml

This file was deleted.

59 changes: 0 additions & 59 deletions config/default-parameters.yaml

This file was deleted.

2 changes: 2 additions & 0 deletions config/internal-parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ parameters:
_dev_version: 'dev'
version: '%env(default:_dev_version:VERSION)%'
anonymousUserUUID: '%env(ANONYMOUS_USER_UUID)%'
problemInstanceLinks:
404-not-found: null
4 changes: 0 additions & 4 deletions config/packages/ember_nexus.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
ember_nexus:
register:
enabled: true
instanceConfiguration:
showVersion: false
2 changes: 0 additions & 2 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

imports:
- {resource: internal-parameters.yaml}
- {resource: default-parameters.yaml}
- {resource: custom-parameters.yaml}

services:
# default configuration for services in *this* file
Expand Down
33 changes: 17 additions & 16 deletions lib/EmberNexusBundle/src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace EmberNexusBundle\DependencyInjection;

use EmberNexusBundle\Service\EmberNexusConfiguration;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

Expand All @@ -19,79 +20,79 @@ public function getConfigTreeBuilder(): TreeBuilder
$rootNode
->children()

->arrayNode('pageSize')
->arrayNode(EmberNexusConfiguration::PAGE_SIZE)
->info('Affects how many elements can be returned in collection responses.')
->addDefaultsIfNotSet()
->children()
->integerNode('min')
->integerNode(EmberNexusConfiguration::PAGE_SIZE_MIN)
->info('Minimum number of elements which are always returned, if they exist.')
->min(1)
->defaultValue(5)
->end()
->integerNode('default')
->integerNode(EmberNexusConfiguration::PAGE_SIZE_DEFAULT)
->info('Default number of elements which are returned if they exist.')
->min(1)
->defaultValue(25)
->end()
->integerNode('max')
->integerNode(EmberNexusConfiguration::PAGE_SIZE_MAX)
->info('Maximum number of elements which are returned in a single response. Should not be way more than 100, as performance problems may arise.')
->min(1)
->defaultValue(100)
->end()
->end()
->end()

->arrayNode('register')
->arrayNode(EmberNexusConfiguration::REGISTER)
->info('Handles the /register endpoint.')
->addDefaultsIfNotSet()
->children()
->booleanNode('enabled')
->booleanNode(EmberNexusConfiguration::REGISTER_ENABLED)
->info('If true, the /register endpoint is active and anonymous users can create accounts.')
->defaultTrue()
->end()
->scalarNode('uniqueIdentifier')
->scalarNode(EmberNexusConfiguration::REGISTER_UNIQUE_IDENTIFIER)
->info('The property name of the identifier. Identifier must be unique across the API, usually the email.')
->defaultValue('email')
->end()
->integerNode('uniqueIdentifierRegex')
->scalarNode(EmberNexusConfiguration::REGISTER_UNIQUE_IDENTIFIER_REGEX)
->info('Either false or a regex for checking the identifier content.')
->defaultFalse()
->end()
->end()
->end()

->arrayNode('instanceConfiguration')
->arrayNode(EmberNexusConfiguration::INSTANCE_CONFIGURATION)
->info('Configures the /instance-configuration endpoint')
->addDefaultsIfNotSet()
->children()
->booleanNode('enabled')
->booleanNode(EmberNexusConfiguration::INSTANCE_CONFIGURATION_ENABLED)
->info('If true, enables the endpoint. If false, 403 error messages are returned.')
->defaultTrue()
->end()
->scalarNode('showVersion')
->booleanNode(EmberNexusConfiguration::INSTANCE_CONFIGURATION_SHOW_VERSION)
->info('If false, the version number is omitted.')
->defaultTrue()
->end()
->end()
->end()

->arrayNode('token')
->arrayNode(EmberNexusConfiguration::TOKEN)
->info('Configures the /instance-configuration endpoint')
->addDefaultsIfNotSet()
->children()
->integerNode('minLifetimeInSeconds')
->integerNode(EmberNexusConfiguration::TOKEN_MIN_LIFETIME_IN_SECONDS)
->info('Minimum lifetime of created tokens.')
->defaultValue(self::HALF_AN_HOUR_IN_SECONDS)
->end()
->integerNode('defaultLifetimeInSeconds')
->integerNode(EmberNexusConfiguration::TOKEN_DEFAULT_LIFETIME_IN_SECONDS)
->info('Default lifetime of created tokens.')
->defaultValue(self::THREE_HOURS_IN_SECONDS)
->end()
->scalarNode('maxLifetimeInSeconds')
->scalarNode(EmberNexusConfiguration::TOKEN_MAX_LIFETIME_IN_SECONDS)
->info('Maximum lifetime of created tokens. Can be set to false to disable maximum limit.')
->defaultValue(self::THIRTEEN_MONTHS_IN_SECONDS)
->end()
->scalarNode('deleteExpiredTokensAutomaticallyInSeconds')
->scalarNode(EmberNexusConfiguration::TOKEN_DELETE_EXPIRED_TOKENS_AUTOMATICALLY_IN_SECONDS)
->info('Expired tokens will be deleted after defined time. Can be set to false to disable auto delete feature.')
->defaultValue(self::TWO_WEEKS_IN_SECONDS)
->end()
Expand Down
Loading

0 comments on commit 9b04a3e

Please sign in to comment.