imports:
    - { resource: defaults.yml }
    - { resource: parameters.yml }
    - { resource: security.yml }

framework:
    secret:          '%secret%'
    router:
        resource: '%kernel.root_dir%/config/routing.yml'
        strict_requirements: '%kernel.debug%'
    form:            true
    csrf_protection: true
    validation:      { enable_annotations: true }
    translator:      { fallback: en }
    templating:      { engines: ['twig'] }
    assets:
        version: 'v=%assets_version%'
    default_locale: '%locale%'
    session:
        name:            packagist
        cookie_lifetime: 3600
        cookie_httponly: true
        save_path: '%session_save_path%'
    trusted_hosts: '%trusted_hosts%'
    http_method_override: true
    fragments: ~

# Twig Configuration
twig:
    form_themes:
        - 'PackagistWebBundle::forms.html.twig'
    debug:            '%kernel.debug%'
    strict_variables: '%kernel.debug%'
    globals:
        google_analytics: '%google_analytics%'
        packagist_host: '%packagist_host%'
        algolia:
          app_id: '%algolia.app_id%'
          search_key: '%algolia.search_key%'
          index_name: '%algolia.index_name%'

# Doctrine Configuration
doctrine:
    dbal:
        driver:   '%database_driver%'
        host:     '%database_host%'
        dbname:   '%database_name%'
        user:     '%database_user%'
        password: '%database_password%'
        charset:  utf8mb4
        # See https://github.com/sonata-project/SonataAdminBundle/issues/3342
        server_version: 8.0
        options:
            # PDO::ATTR_TIMEOUT
            2: 1.3
    orm:
        auto_generate_proxy_classes: '%kernel.debug%'
        auto_mapping: true

snc_redis:
    clients:
        default:
            type: predis
            alias: default
            dsn: '%redis_dsn%'
            options:
                profile: 3.2
                connection_timeout: 1
        cache:
            type: predis
            alias: cache
            dsn: '%redis_dsn%'
            options:
                profile: 3.2
                connection_timeout: 1
    session:
        client: cache
        prefix: 'sess:'
        ttl: 3600

# Swiftmailer Configuration
swiftmailer:
    default_mailer: main
    mailers:
        # default main mailer for controllers and whatnot.. uses a memory spool
        # to delay sending until end of the request
        main:
            transport: '%mailer_transport%'
            host:      '%mailer_host%'
            username:  '%mailer_user%'
            password:  '%mailer_password%'
            encryption: '%mailer_encryption%'
            port: 587
            auth_mode: '%mailer_auth_mode%'
            spool:     { type: memory }
        # fast mailer for background workers that does not spool but rather sends instantaneously
        # request it to be injected by defining the argument as $instantMailer
        instant:
            transport: '%mailer_transport%'
            host:      '%mailer_host%'
            username:  '%mailer_user%'
            password:  '%mailer_password%'
            encryption: '%mailer_encryption%'
            port: 587
            auth_mode: '%mailer_auth_mode%'

fos_user:
    db_driver:     orm
    firewall_name: main
    user_class:  Packagist\WebBundle\Entity\User
    use_username_form_type: true
    from_email:
        address:        '%mailer_from_email%'
        sender_name:    '%mailer_from_name%'
    profile:
        form:
            type: Packagist\WebBundle\Form\Type\ProfileFormType

hwi_oauth:
    firewall_names: [main]
    connect:
        account_connector: packagist.user_provider
        registration_form_handler: packagist.oauth.registration_form_handler
        registration_form: packagist.oauth.registration_form
    fosub:
        username_iterations: 30
        properties:
            github: githubId
    resource_owners:
        github:
            type:          github
            client_id:     '%github.client_id%'
            client_secret: '%github.client_secret%'
            scope: admin:repo_hook,read:org
            options:
                csrf: true

scheb_two_factor:
    security_tokens:
        - Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken
        - HWI\Bundle\OAuthBundle\Security\Core\Authentication\Token\OAuthToken

    backup_codes:
        enabled: true
        manager: Packagist\WebBundle\Security\TwoFactorAuthManager

    totp:
        enabled: true
        server_name: '%packagist_host%'
        issuer: Packagist
        window: 1

    trusted_device:
        enabled: true
        lifetime: 2592000 # 30 days

nelmio_cors:
    defaults:
        allow_origin: ['*']
        allow_headers: ['*']
        max_age: 3600
    paths:
        '^/packages/list\.json$':
            allow_methods: ['GET']
            forced_allow_origin_value: '*'
        '^/search\.json$':
            allow_methods: ['GET']
        '^/packages/[^/]+/[^/]+\.json$':
            allow_methods: ['GET']
            forced_allow_origin_value: '*'

httplug:
    plugins:
        logger: ~
    clients:
        default:
            factory: 'httplug.factory.guzzle6'
            plugins: ['httplug.plugin.logger']
            config:
                timeout: 2

sensio_framework_extra:
    router: { annotations: false }

endroid_qr_code:
    background_color: { r: 250, g: 250, b: 250 }
