Method: Imperium::Configuration#send_timeout
- Defined in:
-
lib/imperium/configuration.rb,
lib/imperium/configuration.rb
finish uploading to Consul to open before failing, default: 15.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/imperium/configuration.rb', line 24 class Configuration extend Forwardable attr_reader :url attr_accessor :connect_timeout, :receive_timeout, :send_timeout, :token def initialize(url: 'http://localhost:8500', token: nil) @url = Addressable::URI.parse(url) @connect_timeout = 5 @send_timeout = 15 @receive_timeout = 60 @token = token end def_delegators :@url, :host, :host=, :port, :port= # Check if the specified URL is using SSL/TLS # @return [Boolean] def ssl? @url.scheme == 'https' end # Configure the clients to use SSL/TLS (or not). # # @param value [Boolean] # @raise [NoMethodError] When the URL has previously been set to nil. def ssl=(value) @url.scheme = (!!value ? 'https' : 'http') end # Check for the presence of a token # @return [Boolean] def token? @token && !@token.empty? end # Set the URL # # This method will append a trailing slash to the supplied URL if not # included. We're doing this because merging a path onto a URL missing the # trailing slash will remove any extant path components. # # @param value [String, Addressable::URI, URI::GenericURI] The new value to use. def url=(value) if value.nil? @url = nil else @url = Addressable::URI.parse(value) @url.path << '/' unless @url.path.end_with?('/') end end end |