Use parameters directly instead of bundle config

This commit is contained in:
Yassine Guedidi 2024-02-19 00:58:19 +01:00
parent 6879bb2435
commit 09ef700fda
3 changed files with 22 additions and 119 deletions

View file

@ -1,7 +1,7 @@
wallabag_core:
version: 2.6.8
paypal_url: "https://liberapay.com/wallabag/donate"
languages:
parameters:
wallabag_core.version: 2.6.8
wallabag_core.paypal_url: "https://liberapay.com/wallabag/donate"
wallabag_core.languages:
en: 'English'
fr: 'Français'
de: 'Deutsch'
@ -23,20 +23,20 @@ wallabag_core:
hr: 'Hrvatski'
cs: 'Čeština'
el: 'Ελληνικά'
items_on_page: 12
language: '%locale%'
rss_limit: 50
reading_speed: 200
cache_lifetime: 10
action_mark_as_read: 1
list_mode: 0
display_thumbnails: 1
fetching_error_message_title: 'No title found'
fetching_error_message: |
wallabag_core.items_on_page: 12
wallabag_core.language: '%locale%'
wallabag_core.feed_limit: 50
wallabag_core.reading_speed: 200
wallabag_core.cache_lifetime: 10
wallabag_core.action_mark_as_read: 1
wallabag_core.list_mode: 0
wallabag_core.display_thumbnails: 1
wallabag_core.fetching_error_message_title: 'No title found'
wallabag_core.fetching_error_message: |
wallabag can't retrieve contents for this article. Please <a href="https://doc.wallabag.org/en/user/errors_during_fetching.html#how-can-i-help-to-fix-that">troubleshoot this issue</a>.
api_limit_mass_actions: 10
encryption_key_path: "%kernel.project_dir%/data/site-credentials-secret-key.txt"
default_internal_settings:
wallabag_core.api_limit_mass_actions: 10
wallabag_core.site_credentials.encryption_key_path: "%kernel.project_dir%/data/site-credentials-secret-key.txt"
wallabag_core.default_internal_settings:
-
name: share_public
value: 1
@ -146,14 +146,14 @@ wallabag_core:
value: 0
section: entry
default_ignore_origin_instance_rules:
wallabag_core.default_ignore_origin_instance_rules:
-
rule: host = "feedproxy.google.com"
-
rule: host = "feeds.reuters.com"
-
rule: _all ~ "https?://www\.lemonde\.fr/tiny.*"
fonts:
wallabag_core.fonts:
- 'Sans-serif'
- 'Serif'
- 'Atkinson Hyperlegible'
@ -162,5 +162,5 @@ wallabag_core:
- 'Montserrat'
- 'OpenDyslexicRegular'
- 'Oswald'
allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain', 'text/csv', 'text/html']
resource_dir: "%kernel.project_dir%/web/uploads/import"
wallabag_core.allow_mimetypes: ['application/octet-stream', 'application/json', 'text/plain', 'text/csv', 'text/html']
wallabag_core.resource_dir: "%kernel.project_dir%/web/uploads/import"

View file

@ -9,80 +9,6 @@ class Configuration implements ConfigurationInterface
{
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder('wallabag_core');
$rootNode = $treeBuilder->getRootNode();
$rootNode
->children()
->arrayNode('languages')
->prototype('scalar')->end()
->end()
->integerNode('items_on_page')
->defaultValue(12)
->end()
->scalarNode('language')
->defaultValue('en')
->end()
->integerNode('rss_limit')
->defaultValue(50)
->end()
->integerNode('reading_speed')
->defaultValue(200)
->end()
->scalarNode('version')
->end()
->scalarNode('paypal_url')
->end()
->integerNode('cache_lifetime')
->defaultValue(10)
->end()
->scalarNode('fetching_error_message')
->end()
->scalarNode('fetching_error_message_title')
->end()
->scalarNode('action_mark_as_read')
->defaultValue(1)
->end()
->scalarNode('list_mode')
->defaultValue(1)
->end()
->scalarNode('display_thumbnails')
->defaultValue(1)
->end()
->scalarNode('api_limit_mass_actions')
->defaultValue(10)
->end()
->arrayNode('default_internal_settings')
->prototype('array')
->children()
->scalarNode('name')->end()
->scalarNode('value')->end()
->enumNode('section')
->values(['entry', 'misc', 'api', 'analytics', 'export', 'import'])
->end()
->end()
->end()
->end()
->scalarNode('encryption_key_path')
->end()
->arrayNode('default_ignore_origin_instance_rules')
->prototype('array')
->children()
->scalarNode('rule')->end()
->end()
->end()
->end()
->arrayNode('fonts')
->prototype('scalar')->end()
->end()
->arrayNode('allow_mimetypes')
->prototype('scalar')->end()
->end()
->scalarNode('resource_dir')
->end()
->end()
;
return $treeBuilder;
return new TreeBuilder('wallabag_core');
}
}

View file

@ -9,29 +9,6 @@ class WallabagCoreExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$container->setParameter('wallabag_core.languages', $config['languages']);
$container->setParameter('wallabag_core.items_on_page', $config['items_on_page']);
$container->setParameter('wallabag_core.language', $config['language']);
$container->setParameter('wallabag_core.feed_limit', $config['rss_limit']);
$container->setParameter('wallabag_core.reading_speed', $config['reading_speed']);
$container->setParameter('wallabag_core.version', $config['version']);
$container->setParameter('wallabag_core.paypal_url', $config['paypal_url']);
$container->setParameter('wallabag_core.cache_lifetime', $config['cache_lifetime']);
$container->setParameter('wallabag_core.action_mark_as_read', $config['action_mark_as_read']);
$container->setParameter('wallabag_core.list_mode', $config['list_mode']);
$container->setParameter('wallabag_core.display_thumbnails', $config['display_thumbnails']);
$container->setParameter('wallabag_core.fetching_error_message', $config['fetching_error_message']);
$container->setParameter('wallabag_core.fetching_error_message_title', $config['fetching_error_message_title']);
$container->setParameter('wallabag_core.api_limit_mass_actions', $config['api_limit_mass_actions']);
$container->setParameter('wallabag_core.default_internal_settings', $config['default_internal_settings']);
$container->setParameter('wallabag_core.site_credentials.encryption_key_path', $config['encryption_key_path']);
$container->setParameter('wallabag_core.default_ignore_origin_instance_rules', $config['default_ignore_origin_instance_rules']);
$container->setParameter('wallabag_core.fonts', $config['fonts']);
$container->setParameter('wallabag_core.allow_mimetypes', $config['allow_mimetypes']);
$container->setParameter('wallabag_core.resource_dir', $config['resource_dir']);
}
public function getAlias()