You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -383,7 +383,7 @@ use an initializer as follows:
383
383
Mongoid.logger = Logger.new(STDERR).tap do |logger|
384
384
logger.level = Logger::DEBUG
385
385
end
386
-
386
+
387
387
# Change driver log destination and/or level
388
388
Mongo::Logger.logger = Logger.new(STDERR).tap do |logger|
389
389
logger.level = Logger::DEBUG
@@ -484,12 +484,12 @@ time zone handling is as follows:
484
484
485
485
.. code-block:: bash
486
486
487
-
cp /usr/share/zoneinfo/UTC /etc/localtime
487
+
cp /usr/share/zoneinfo/UTC /etc/localtime
488
488
489
489
2. Set ActiveSupport's time zone to UTC:
490
490
491
491
.. code-block:: ruby
492
-
492
+
493
493
# If using Rails, in application.rb:
494
494
class Application < Rails::Application
495
495
config.time_zone = 'UTC'
@@ -525,33 +525,33 @@ Mongoid offers the following time zone-related configuration options:
525
525
When parsing times without time zone information (such as when
526
526
mongoizing strings or arrays to time), assume the times are specified
527
527
in ActiveSupport's time zone. This is the default.
528
-
528
+
529
529
If false, prefer to work with times using Ruby standard library ``Time`` class.
530
530
Values in fields of type ``Time`` will be returned as ``Time`` instances.
531
531
When parsing times without time zone information, assume the times
532
532
are specified in the Ruby time zone.
533
-
533
+
534
534
Note that the ``use_activesupport_time_zone`` setting does not affect
535
535
fields of types ``Date`` or ``DateTime``, which use ``Date`` and
536
536
``DateTime`` classes for their values, respectively.
537
-
537
+
538
538
Also note that Mongoid may still utilize both ``Time`` and
539
539
``ActiveSupport::TimeWithZone`` classes internally, as appropriate,
540
540
regardless of the ``use_activesupport_time_zone`` setting.
541
-
- ``use_utc``:
541
+
- ``use_utc``:
542
542
If true, times stored in MongoDB will be returned in UTC.
543
543
If false, times stored in MongoDB will be returned in local time
544
544
(as instances of either ``Time`` or ``ActiveSupport::TimeWithZone``,
545
545
respectively in the Ruby default time zone or the ActiveSupport time zone,
546
546
based on the value of ``use_activesupport_time_zone`` setting).
547
547
The default is false.
548
-
548
+
549
549
The ``use_utc`` setting does not affect how times are parsed - parsing
550
550
is always done in local time when the input being parsed does not
551
551
include time zone information. To parse dates in UTC, set the
552
552
system/Ruby or ActiveSupport time zone to UTC (as mentioned above,
553
553
setting all three to UTC leads to the fewest headaches).
554
-
554
+
555
555
Setting ``use_activesupport_time_zone`` to true and ``Time.zone`` to
556
556
UTC (and using ActiveSupport time machinery for all time-related
557
557
operations) is recommended over setting ``use_utc`` to true.
@@ -562,6 +562,42 @@ instance does have an associated time zone, and this time zone will be used
562
562
even if it is different from ActiveSupport's configured time zone when
563
563
``use_activesupport_time_zone`` is true.
564
564
565
+
Configuring ``SSLContext``
566
+
==========================
567
+
It may be desirable to further configure TLS options in your application, for
568
+
example by enabling or disabling certain ciphers.
569
+
570
+
This can be done by setting TLS context hooks on the Ruby driver -- TLS context
571
+
hooks are user-provided ``Proc``s that will be invoked before any TLS socket
572
+
connection in the driver and can be used to modify the underlying
573
+
``OpenSSL::SSL::SSLContext`` object used by the socket.
574
+
575
+
To set TLS context hooks, add ``Proc``s to the ``Mongo.tls_context_hooks``
576
+
array. This can be done in an initializer. The example below adds a hook
577
+
that only enables the "AES256-SHA" cipher.
578
+
579
+
.. code-block:: ruby
580
+
581
+
Mongo.tls_context_hooks.push(
582
+
Proc.new { |context|
583
+
context.ciphers = ["AES256-SHA"]
584
+
}
585
+
)
586
+
587
+
# Only the AES256-SHA cipher will be enabled from this point forward
588
+
589
+
Every ``Proc`` in ``Mongo.tls_context_hooks`` will be passed an
590
+
``OpenSSL::SSL::SSLContext`` object as its sole argument. These ``Proc``s will
591
+
be executed sequentially during socket creation.
592
+
593
+
..warning ::
594
+
595
+
TLS context hooks are global and will affect all ``Mongo::Client`` instances
596
+
in an application.
597
+
598
+
For more information about TLS context hooks, including best practices for
599
+
assigning and removing them, see `the Ruby driver documentation <https://docs.mongodb.com/ruby-driver/current/tutorials/ruby-driver-create-client/#modifying-sslcontext>`_.
0 commit comments