Class: Aptly::Configuration

Inherits:
Object
  • Object
show all
Extended by:
Gem::Deprecate
Defined in:
lib/aptly/configuration.rb

Overview

Configuration.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri: URI::HTTP.build(host: 'localhost', port: 80, path: '/'), timeout: [60, faraday_default_timeout].max, write_timeout: [10 * 60, timeout].max, host: nil, port: nil, path: nil) ⇒ Configuration

Creates a new instance.

Parameters:

  • uri (defaults to: URI::HTTP.build(host: 'localhost', port: 80, path: '/'))

    see #uri

  • timeout (defaults to: [60, faraday_default_timeout].max)

    see #timeout

  • write_timeout (defaults to: [10 * 60, timeout].max)
  • host (defaults to: nil)

    DEPRECATED use uri

  • port (defaults to: nil)

    DEPRECATED use uri

  • path (defaults to: nil)

    DEPRECATED use uri



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/aptly/configuration.rb', line 60

def initialize(uri: URI::HTTP.build(host: 'localhost',
                                    port: 80,
                                    path: '/'),
               timeout: [60, faraday_default_timeout].max,
               write_timeout: [10 * 60, timeout].max,
               host: nil, port: nil, path: nil)
  @timeout = timeout
  @write_timeout = write_timeout
  @uri = nil
  @uri = uri unless host || port || path
  return if @uri
  @uri = fallback_uri(host, port, path)
end

Instance Attribute Details

#hostString

Deprecated.

use #uri

Returns host name to talk to.

Returns:

  • (String)

    host name to talk to



# File 'lib/aptly/configuration.rb', line 75

#pathString

Deprecated.

use #uri

Returns path to use (defaults to /).

Returns:

  • (String)

    path to use (defaults to /)



# File 'lib/aptly/configuration.rb', line 83

#portInteger

Deprecated.

use #uri

Returns port to talk to host to on.

Returns:

  • (Integer)

    port to talk to host to on



# File 'lib/aptly/configuration.rb', line 79

#timeoutObject

The request read timeout in seconds. HTTP connections not responding in this time limit will raise an error. Note that the server-side API is currently synchronous so a read request may time out for no better reason than it not getting a suitable database lock in time, so allowing for some leeway is recommended here. github.com/smira/aptly/pull/459



37
38
39
# File 'lib/aptly/configuration.rb', line 37

def timeout
  @timeout
end

#uriObject

Generally any suitable URI is allowed. This can also be a Unix domain socket which needs to be used in the notation unix:/tmp/sock.



27
28
29
# File 'lib/aptly/configuration.rb', line 27

def uri
  @uri
end

#write_timeoutObject

The request write timeout in seconds. HTTP connections not responding in this time limit will raise an error. When pushing data into Aptly or publishing large repositories this value should be suitably high. This timeout is used for API calls which we expect to need a write-lock on the server. Using a value of a couple minutes is recommended if you have concurrent write requests (multiple uploads from different sources) or the server performance isn’t always assured (slow disk, load spikes).



49
50
51
# File 'lib/aptly/configuration.rb', line 49

def write_timeout
  @write_timeout
end