wallabag/app/config/services.yml
Jeremy Benoist 6aca334d53
Move to controller as a service
Mostly using autowiring to inject deps.
The only tricky part was for import because all producer use the same class and have a different alias. So we must write them down in the service definition, autowiring doesn't work in that case.

Usually:
- if a controller has a constructor, it means injected services are at least re-used once in actions
- otherwise, service are injected per action
2022-12-19 10:38:08 +01:00

362 lines
14 KiB
YAML

imports:
- { resource: services_rabbit.yml }
- { resource: services_redis.yml }
- { resource: parameters_addons.yml }
parameters:
lexik_form_filter.get_filter.doctrine_orm.class: Wallabag\CoreBundle\Event\Subscriber\CustomDoctrineORMSubscriber
services:
_defaults:
autowire: true
autoconfigure: true
public: true
bind:
$rootDir: '%kernel.root_dir%'
$debug: '%kernel.debug%'
$defaultLocale: '%kernel.default_locale%'
$wallabagUrl: '%domain_name%'
$tablePrefix: "%database_table_prefix%"
$encryptionKeyPath: "%wallabag_core.site_credentials.encryption_key_path%"
$fetchingErrorMessageTitle: "%wallabag_core.fetching_error_message_title%"
$fetchingErrorMessage: '%wallabag_core.fetching_error_message%'
$languages: '%wallabag_core.languages%'
$lifeTime: '%wallabag_core.cache_lifetime%'
$cookieFile: "%kernel.cache_dir%/cookiejar.json"
$logoPath: 'web/img/appicon/apple-touch-icon-152.png'
$registrationEnabled: '%fosuser_registration%'
$restrictedAccess: '@=service(''craue_config'').get(''restricted_access'')'
$senderEmail: "%scheb_two_factor.email.sender_email%"
$senderName: "%scheb_two_factor.email.sender_name%"
$storeArticleHeaders: '@=service(''craue_config'').get(''store_article_headers'')'
$supportUrl: '@=service(''craue_config'').get(''wallabag_support_url'')'
Wallabag\AnnotationBundle\:
resource: '../../src/Wallabag/AnnotationBundle/*'
exclude: '../../src/Wallabag/AnnotationBundle/{Controller,Entity}'
Wallabag\ApiBundle\:
resource: '../../src/Wallabag/ApiBundle/*'
exclude: '../../src/Wallabag/ApiBundle/{Controller,Entity}'
Wallabag\CoreBundle\:
resource: '../../src/Wallabag/CoreBundle/*'
exclude: ['../../src/Wallabag/CoreBundle/{Controller,Entity}', '../../src/Wallabag/CoreBundle/Event/*Event.php']
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
Wallabag\AnnotationBundle\Controller\:
resource: '../../src/Wallabag/AnnotationBundle/Controller/'
tags: ['controller.service_arguments']
Wallabag\ApiBundle\Controller\:
resource: '../../src/Wallabag/ApiBundle/Controller/'
tags: ['controller.service_arguments']
Wallabag\CoreBundle\Controller\:
resource: '../../src/Wallabag/CoreBundle/Controller/'
tags: ['controller.service_arguments']
Wallabag\ImportBundle\Controller\:
resource: '../../src/Wallabag/ImportBundle/Controller/'
tags: ['controller.service_arguments']
Wallabag\UserBundle\Controller\:
resource: '../../src/Wallabag/UserBundle/Controller/'
tags: ['controller.service_arguments']
# inject alias service into controllers
Wallabag\ImportBundle\Controller\ChromeController:
arguments:
$rabbitMqProducer: '@old_sound_rabbit_mq.import_chrome_producer'
$redisProducer: '@wallabag_import.producer.redis.chrome'
Wallabag\ImportBundle\Controller\DeliciousController:
arguments:
$rabbitMqProducer: '@old_sound_rabbit_mq.import_delicious_producer'
$redisProducer: '@wallabag_import.producer.redis.delicious'
Wallabag\ImportBundle\Controller\ElcuratorController:
arguments:
$rabbitMqProducer: '@old_sound_rabbit_mq.import_elcurator_producer'
$redisProducer: '@wallabag_import.producer.redis.elcurator'
Wallabag\ImportBundle\Controller\FirefoxController:
arguments:
$rabbitMqProducer: '@old_sound_rabbit_mq.import_firefox_producer'
$redisProducer: '@wallabag_import.producer.redis.firefox'
Wallabag\ImportBundle\Controller\InstapaperController:
arguments:
$rabbitMqProducer: '@old_sound_rabbit_mq.import_instapaper_producer'
$redisProducer: '@wallabag_import.producer.redis.instapaper'
Wallabag\ImportBundle\Controller\PinboardController:
arguments:
$rabbitMqProducer: '@old_sound_rabbit_mq.import_pinboard_producer'
$redisProducer: '@wallabag_import.producer.redis.pinboard'
Wallabag\ImportBundle\Controller\PocketController:
arguments:
$rabbitMqProducer: '@old_sound_rabbit_mq.import_pocket_producer'
$redisProducer: '@wallabag_import.producer.redis.pocket'
Wallabag\ImportBundle\Controller\ReadabilityController:
arguments:
$rabbitMqProducer: '@old_sound_rabbit_mq.import_readability_producer'
$redisProducer: '@wallabag_import.producer.redis.readability'
Wallabag\ImportBundle\Controller\WallabagV1Controller:
arguments:
$rabbitMqProducer: '@old_sound_rabbit_mq.import_wallabag_v1_producer'
$redisProducer: '@wallabag_import.producer.redis.wallabag_v1'
Wallabag\ImportBundle\Controller\WallabagV2Controller:
arguments:
$rabbitMqProducer: '@old_sound_rabbit_mq.import_wallabag_v2_producer'
$redisProducer: '@wallabag_import.producer.redis.wallabag_v2'
Wallabag\ImportBundle\:
resource: '../../src/Wallabag/ImportBundle/*'
exclude: '../../src/Wallabag/ImportBundle/{Consumer,Controller,Redis}'
Wallabag\UserBundle\:
resource: '../../src/Wallabag/UserBundle/*'
exclude: '../../src/Wallabag/UserBundle/{Controller,Entity}'
Doctrine\DBAL\Connection:
alias: doctrine.dbal.default_connection
Doctrine\ORM\EntityManagerInterface:
alias: doctrine.orm.entity_manager
Doctrine\Persistence\ManagerRegistry:
alias: doctrine
Craue\ConfigBundle\Util\Config:
alias: craue_config
JMS\Serializer\SerializerInterface:
alias: jms_serializer
Lexik\Bundle\FormFilterBundle\Filter\FilterBuilderUpdaterInterface:
alias: lexik_form_filter.query_builder_updater
Scheb\TwoFactorBundle\Security\TwoFactor\Provider\Google\GoogleAuthenticatorInterface:
alias: scheb_two_factor.security.google_authenticator
Symfony\Component\HttpFoundation\Session\SessionInterface:
alias: session
Symfony\Component\EventDispatcher\EventDispatcherInterface:
alias: event_dispatcher
Symfony\Component\Form\FormFactoryInterface:
alias: form.factory
Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface:
alias: security.token_storage
Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface:
alias: security.authorization_checker
Symfony\Component\Translation\TranslatorInterface:
alias: translator
Symfony\Component\Validator\Validator\ValidatorInterface:
alias: validator
FOS\UserBundle\Model\UserManagerInterface:
alias: fos_user.user_manager
MatomoTwigExtension\MatomoTwigExtension:
public: false
Wallabag\CoreBundle\Event\Listener\UserLocaleListener:
tags:
- { name: kernel.event_listener, event: security.interactive_login, method: onInteractiveLogin }
craue_config_cache_provider:
class: Symfony\Component\Cache\Adapter\FilesystemAdapter
public: false
arguments:
$namespace: 'craue_config'
$defaultLifetime: 0
$directory: '%kernel.cache_dir%'
Wallabag\CoreBundle\ParamConverter\UsernameFeedTokenConverter:
tags:
- { name: request.param_converter, converter: username_feed_token_converter }
Wallabag\CoreBundle\Event\Subscriber\TablePrefixSubscriber:
tags:
- { name: doctrine.event_subscriber }
Graby\Graby:
arguments:
$config:
error_message: '%wallabag_core.fetching_error_message%'
error_message_title: '%wallabag_core.fetching_error_message_title%'
calls:
- [ setLogger, [ "@logger" ] ]
tags:
- { name: monolog.logger, channel: graby }
Graby\SiteConfig\ConfigBuilder:
arguments:
$config: {}
wallabag_core.http_client:
alias: 'httplug.client.wallabag_core'
Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder:
tags:
- { name: monolog.logger, channel: graby }
# service alias override
bd_guzzle_site_authenticator.site_config_builder:
alias: Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder
GuzzleHttp\Cookie\CookieJar:
alias: 'Wallabag\CoreBundle\Helper\FileCookieJar'
Wallabag\CoreBundle\Helper\HttpClientFactory:
calls:
- ["addSubscriber", ["@bd_guzzle_site_authenticator.authenticator_subscriber"]]
RulerZ\RulerZ:
alias: rulerz
Wallabag\CoreBundle\Operator\PHP\Matches:
tags:
- { name: rulerz.operator, target: native, operator: matches }
Wallabag\CoreBundle\Operator\Doctrine\Matches:
tags:
- { name: rulerz.operator, target: doctrine, operator: matches, inline: true }
Wallabag\CoreBundle\Operator\PHP\NotMatches:
tags:
- { name: rulerz.operator, target: native, operator: notmatches }
Wallabag\CoreBundle\Operator\Doctrine\NotMatches:
tags:
- { name: rulerz.operator, target: doctrine, operator: notmatches, inline: true }
Wallabag\CoreBundle\Operator\PHP\PatternMatches:
tags:
- { name: rulerz.operator, target: native, operator: "~" }
Predis\Client:
arguments:
$parameters:
scheme: '%redis_scheme%'
host: '%redis_host%'
port: '%redis_port%'
path: '%redis_path%'
password: '%redis_password%'
Wallabag\CoreBundle\Event\Subscriber\SQLiteCascadeDeleteSubscriber:
tags:
- { name: doctrine.event_subscriber }
Wallabag\CoreBundle\Event\Subscriber\DownloadImagesSubscriber:
arguments:
$enabled: '@=service(''craue_config'').get(''download_images_enabled'')'
Wallabag\CoreBundle\Helper\DownloadImages:
arguments:
$baseFolder: "%kernel.project_dir%/web/assets/images"
Wallabag\CoreBundle\Command\ExportCommand:
arguments:
$projectDir: '%kernel.project_dir%'
Wallabag\CoreBundle\Command\InstallCommand:
arguments:
$databaseDriver: '%database_driver%'
$databaseName: '%database_name%'
$defaultSettings: '%wallabag_core.default_internal_settings%'
$defaultIgnoreOriginInstanceRules: '%wallabag_core.default_ignore_origin_instance_rules%'
wallabag_core.entry.download_images.client:
alias: 'httplug.client.wallabag_core.entry.download_images'
Wallabag\UserBundle\Mailer\UserMailer:
arguments:
$parameters:
template:
confirmation: '%fos_user.registration.confirmation.template%'
resetting: '%fos_user.resetting.email.template%'
from_email:
confirmation: '%fos_user.registration.confirmation.from_email%'
resetting: '%fos_user.resetting.email.from_email%'
Wallabag\UserBundle\EventListener\CreateConfigListener:
arguments:
$itemsOnPage: "%wallabag_core.items_on_page%"
$feedLimit: "%wallabag_core.feed_limit%"
$language: "%wallabag_core.language%"
$readingSpeed: "%wallabag_core.reading_speed%"
$actionMarkAsRead: "%wallabag_core.action_mark_as_read%"
$listMode: "%wallabag_core.list_mode%"
Wallabag\UserBundle\EventListener\AuthenticationFailureListener:
tags:
- { name: kernel.event_listener, event: security.authentication.failure, method: onAuthenticationFailure }
wallabag_import.pocket.client:
alias: 'httplug.client.wallabag_import.pocket.client'
Wallabag\ImportBundle\Import\PocketImport:
calls:
- [ setClient, [ "@wallabag_import.pocket.client" ] ]
tags:
- { name: wallabag_import.import, alias: pocket }
Wallabag\ImportBundle\Import\WallabagV1Import:
tags:
- { name: wallabag_import.import, alias: wallabag_v1 }
Wallabag\ImportBundle\Import\WallabagV2Import:
tags:
- { name: wallabag_import.import, alias: wallabag_v2 }
Wallabag\ImportBundle\Import\ElcuratorImport:
tags:
- { name: wallabag_import.import, alias: elcurator }
Wallabag\ImportBundle\Import\ReadabilityImport:
tags:
- { name: wallabag_import.import, alias: readability }
Wallabag\ImportBundle\Import\InstapaperImport:
tags:
- { name: wallabag_import.import, alias: instapaper }
Wallabag\ImportBundle\Import\PinboardImport:
tags:
- { name: wallabag_import.import, alias: pinboard }
Wallabag\ImportBundle\Import\DeliciousImport:
tags:
- { name: wallabag_import.import, alias: delicious }
Wallabag\ImportBundle\Import\FirefoxImport:
tags:
- { name: wallabag_import.import, alias: firefox }
Wallabag\ImportBundle\Import\ChromeImport:
tags:
- { name: wallabag_import.import, alias: chrome }
# to factorize the proximity and bypass translation for prev & next
pagerfanta.view.default_wallabag:
class: Pagerfanta\View\OptionableView
arguments:
- '@pagerfanta.view.twitter_bootstrap'
- { proximity: 1, prev_message: "<", next_message: ">" }
public: false
tags:
- { name: pagerfanta.view, alias: default_wallabag }