Class: Pantry::Config
- Inherits:
-
Object
- Object
- Pantry::Config
- Defined in:
- lib/pantry/config.rb
Overview
Global configuration values for running all of Pantry.
Instance Attribute Summary collapse
-
#client_application ⇒ Object
Application this Client serves.
-
#client_environment ⇒ Object
Environment of the Application this Client runs.
-
#client_heartbeat_interval ⇒ Object
How often, in seconds, the client pings the Server.
-
#client_identity ⇒ Object
Unique identification of this Client.
-
#client_roles ⇒ Object
Roles this Client serves.
-
#file_service_port ⇒ Object
Port through which files are sent and received.
-
#log_level ⇒ Object
After what level are logs dropped and ignored? Can be any of: “fatal”, “error”, “warn”, “info”, “debug” Each level will include the logs of all levels above it.
-
#log_to ⇒ Object
Where does Pantry log to? Can be “stdout”, “syslog”, or a file system path Defaults to STDOUT When using syslog, program name will be “pantry”.
-
#pub_sub_port ⇒ Object
Port used for Pub/Sub communication.
-
#receive_port ⇒ Object
Port clients use to send information to the Server.
-
#response_timeout ⇒ Object
Time in seconds the CLI will wait for a response from the server By default this is nil, meaning unlimited timeout.
-
#root_dir ⇒ Object
Location on the file system Pantry will store any persistent data Default: /var/lib/pantry.
-
#security ⇒ Object
What type of security will Pantry be employing? Available types are nil (no security) and “curve” (ZMQ4 Curve security).
-
#server_host ⇒ Object
Host name of the Pantry Server.
-
#syslog_program_name ⇒ Object
If logging to Syslog, set the program-name Pantry will use when sending logs to syslog.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#load_file(config_file) ⇒ Object
Given a YAML config file, read in config values.
- #refresh ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/pantry/config.rb', line 89 def initialize # Logging defaults @log_level = "info" @syslog_program_name = "pantry" # Default connectivity settings @server_host = "127.0.0.1" @pub_sub_port = 23001 @receive_port = 23002 @file_service_port = 23003 # Default client heartbeat to every 5 minutes @client_heartbeat_interval = 300 # Default Client identificiation values @client_identity = nil @client_application = nil @client_environment = nil @client_roles = [] end |
Instance Attribute Details
#client_application ⇒ Object
Application this Client serves
73 74 75 |
# File 'lib/pantry/config.rb', line 73 def client_application @client_application end |
#client_environment ⇒ Object
Environment of the Application this Client runs
76 77 78 |
# File 'lib/pantry/config.rb', line 76 def client_environment @client_environment end |
#client_heartbeat_interval ⇒ Object
How often, in seconds, the client pings the Server
56 57 58 |
# File 'lib/pantry/config.rb', line 56 def client_heartbeat_interval @client_heartbeat_interval end |
#client_identity ⇒ Object
Unique identification of this Client
70 71 72 |
# File 'lib/pantry/config.rb', line 70 def client_identity @client_identity end |
#client_roles ⇒ Object
Roles this Client serves
79 80 81 |
# File 'lib/pantry/config.rb', line 79 def client_roles @client_roles end |
#file_service_port ⇒ Object
Port through which files are sent and received
53 54 55 |
# File 'lib/pantry/config.rb', line 53 def file_service_port @file_service_port end |
#log_level ⇒ Object
After what level are logs dropped and ignored? Can be any of: “fatal”, “error”, “warn”, “info”, “debug” Each level will include the logs of all levels above it. Defaults to “info”
28 29 30 |
# File 'lib/pantry/config.rb', line 28 def log_level @log_level end |
#log_to ⇒ Object
Where does Pantry log to? Can be “stdout”, “syslog”, or a file system path Defaults to STDOUT When using syslog, program name will be “pantry”
22 23 24 |
# File 'lib/pantry/config.rb', line 22 def log_to @log_to end |
#pub_sub_port ⇒ Object
Port used for Pub/Sub communication
47 48 49 |
# File 'lib/pantry/config.rb', line 47 def pub_sub_port @pub_sub_port end |
#receive_port ⇒ Object
Port clients use to send information to the Server
50 51 52 |
# File 'lib/pantry/config.rb', line 50 def receive_port @receive_port end |
#response_timeout ⇒ Object
Time in seconds the CLI will wait for a response from the server By default this is nil, meaning unlimited timeout. Used mainly in tests.
87 88 89 |
# File 'lib/pantry/config.rb', line 87 def response_timeout @response_timeout end |
#root_dir ⇒ Object
Location on the file system Pantry will store any persistent data Default: /var/lib/pantry
37 38 39 |
# File 'lib/pantry/config.rb', line 37 def root_dir @root_dir end |
#security ⇒ Object
What type of security will Pantry be employing? Available types are nil (no security) and “curve” (ZMQ4 Curve security)
Defaults to nil because curve security has not yet been fully vetted by the crypto-community
63 64 65 |
# File 'lib/pantry/config.rb', line 63 def security @security end |
#server_host ⇒ Object
Host name of the Pantry Server
44 45 46 |
# File 'lib/pantry/config.rb', line 44 def server_host @server_host end |
#syslog_program_name ⇒ Object
If logging to Syslog, set the program-name Pantry will use when sending logs to syslog. Defaults to “pantry”
33 34 35 |
# File 'lib/pantry/config.rb', line 33 def syslog_program_name @syslog_program_name end |
Instance Method Details
#load_file(config_file) ⇒ Object
Given a YAML config file, read in config values
113 114 115 116 117 118 119 |
# File 'lib/pantry/config.rb', line 113 def load_file(config_file) configs = SafeYAML.load_file(config_file) load_global_configs(configs) load_networking_configs(configs["networking"]) load_client_configs(configs["client"]) refresh end |
#refresh ⇒ Object
121 122 123 |
# File 'lib/pantry/config.rb', line 121 def refresh apply_configuration end |