Class: Locd::Agent::Proxy

Inherits:
Locd::Agent show all
Includes:
System
Defined in:
lib/locd/agent/proxy.rb

Overview

An server Locd::Agent (HTTP only at the moment) that the proxy can route requests to.

Constant Summary collapse

TO_H_NAMES =

Attribute / method names that Locd::Agent#to_h uses.

Returns:

  • (Hamster::SortedSet<Symbol>)
Locd::Agent::TO_H_NAMES.union [:port, :url]

Instance Attribute Summary

Attributes inherited from Locd::Agent

#path, #plist

Instance Methods: Attribute Readers collapse

Class Method Summary collapse

Methods included from System

class_for, classes, included, label?, plist?

Methods inherited from Locd::Agent

#<=>, add, add_or_update, all, class_for, #cmd_template, #config, create_plist_data, default_log_path, #default_log_path?, #err_path, exists?, find_all, find_all!, find_only!, from_path, get, #initialize, #label, labels, #last_exit_code, #load, #log_paths, #out_path, #pid, plist?, plist_abs_path, plists, #reload, #remove, render_cmd, resolve_log_path, #restart, #running?, #start, #status, #stop, #stopped?, #to_h, #to_json, #to_yaml, #unload, #update, user_plist_abs_dir, #workdir

Constructor Details

This class inherits a constructor from Locd::Agent

Class Method Details

.default_cmd_templatereturn_type

TODO:

Document cmd_template method.

Returns @todo Document return value.

Parameters:

  • arg_name (type)

    @todo Add name param description.

Returns:

  • (return_type)

    @todo Document return value.



69
70
71
# File 'lib/locd/agent/proxy.rb', line 69

def self.default_cmd_template
  "{bin} proxy run"
end

.default_write_kwds(cmd_template: self.default_cmd_template, **kwds) ⇒ Object



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/locd/agent/proxy.rb', line 74

def self.default_write_kwds cmd_template: self.default_cmd_template,
                            **kwds
  super(
    keep_alive: true,
    run_at_load: true,
    port: Locd.config[:proxy, :port],
    cmd_template: cmd_template,
    **kwds,
    label: self.label
  )
end

.label_nameString

Returns The non-namespace part of the proxy's label.

Returns:

  • (String)

    The non-namespace part of the proxy's label.



56
57
58
# File 'lib/locd/agent/proxy.rb', line 56

def self.label_name
  "proxy"
end

Instance Method Details

#portFixnum

Returns Port service runs on.

Returns:

  • (Fixnum)

    Port service runs on.



98
99
100
# File 'lib/locd/agent/proxy.rb', line 98

def port
  config['port']
end

#urlString

Returns The URL the agent can be reached at through the proxy.

Returns:

  • (String)

    The URL the agent can be reached at through the proxy.



105
106
107
# File 'lib/locd/agent/proxy.rb', line 105

def url
  "http://#{ label }:#{ Locd.get_port }"
end