Class: PrometheusExporter::Ext::Server::SingletonWebServer
- Inherits:
-
Server::WebServer
- Object
- Server::WebServer
- PrometheusExporter::Ext::Server::SingletonWebServer
- Defined in:
- lib/prometheus_exporter/ext/server/singleton_web_server.rb
Class Attribute Summary collapse
-
.server ⇒ Object
Returns the value of attribute server.
Class Method Summary collapse
- .build_htpasswd(htpasswd_path, username:, password:) ⇒ Object
- .configure_collector {|collector| ... } ⇒ Object
- .start(opts) ⇒ Object
- .stop ⇒ Object
Class Attribute Details
.server ⇒ Object
Returns the value of attribute server.
9 10 11 |
# File 'lib/prometheus_exporter/ext/server/singleton_web_server.rb', line 9 def server @server end |
Class Method Details
.build_htpasswd(htpasswd_path, username:, password:) ⇒ Object
21 22 23 24 25 |
# File 'lib/prometheus_exporter/ext/server/singleton_web_server.rb', line 21 def build_htpasswd(htpasswd_path, username:, password:) htpasswd = WEBrick::HTTPAuth::Htpasswd.new(htpasswd_path) htpasswd.set_passwd PrometheusExporter::DEFAULT_REALM, username, password htpasswd.flush end |
.configure_collector {|collector| ... } ⇒ Object
28 29 30 |
# File 'lib/prometheus_exporter/ext/server/singleton_web_server.rb', line 28 def configure_collector yield server.collector end |
.start(opts) ⇒ Object
11 12 13 14 |
# File 'lib/prometheus_exporter/ext/server/singleton_web_server.rb', line 11 def start(opts) self.server = new(opts) server.start end |
.stop ⇒ Object
16 17 18 19 |
# File 'lib/prometheus_exporter/ext/server/singleton_web_server.rb', line 16 def stop server.stop self.server = nil end |