services:
  #
  # PDO session handler
  #
  XCart\Framework\Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler:
    arguments:
      - 'mysql:%env(DATABASE_URL)%'
      - {
        db_table: 'sessions',
        db_connection_options:
          {
            1009: '%env(resolve:DATABASE_SSL_CA_CERT)%',
            1008: '%env(resolve:DATABASE_SSL_CLIENT_CERT)%',
            1007: '%env(resolve:DATABASE_SSL_CLIENT_KEY)%'
          }
      }

# // PDO session handler

#
# Redis session handler
#

#    Redis:
#        # you can also use \RedisArray, \RedisCluster or \Predis\Client classes
#        class: Redis
#        calls:
#            - connect:
#                  - '%env(REDIS_HOST)%'
#                  - '%env(int:REDIS_PORT)%'
#            # uncomment the following if your Redis server requires a password
#            # - auth:
#            #     - '%env(REDIS_PASSWORD)%'

#    Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler:
#        arguments:
#            - '@Redis'
#            # you can optionally pass an array of options. The only options are 'prefix' and 'ttl',
#            # which define the prefix to use for the keys to avoid collision on the Redis server
#            # and the expiration time for any given entry (in seconds), defaults are 'sf_s' and null:
#            # - { 'prefix': 'my_prefix', 'ttl': 600 }

# // Redis session handler

# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
  http_client:
  secret: '%env(APP_SECRET)%'
  #csrf_protection: true
  http_method_override: false

  # Enables session support. Note that the session will ONLY be started if you read or write from it.
  # Remove or comment this section to explicitly disable session support.
  session:
    gc_divisor: 1000
    storage_factory_id: session.storage.factory.native

    #
    # PDO session handler
    #
    handler_id: XCart\Framework\Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler

    # // PDO session handler

    #
    # Redis session handler
    #
    #handler_id: Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler
    # // Redis session handler

    name: 'xid'
    gc_maxlifetime: 604800 # 7 days
    use_cookies: true
    cookie_lifetime: 2592000 # 30 days
    cookie_secure: auto
    cookie_samesite: lax
    cookie_path: '%env(remove_trailing_slash:string:XCART_HOST_DETAILS_WEB_DIR)%/'

  #esi: true
  #fragments: true
  php_errors:
    log: true

when@test:
  framework:
    test: true
    session:
      storage_factory_id: session.storage.factory.mock_file
