Module: ConsulConfiguration

Extended by:
ApplicationConfiguration
Included in:
ConsulService
Defined in:
lib/consul/consul_configuration.rb

Constant Summary collapse

CONFIG =
{
	port: 8500,
	path: "http://localhost",
	consul_service_data: {
		name: "Service-1",
		id: "Service1",
		port: 9292,
		check: {
		  id: "bluesky-api",
		  name: "HTTP Health Check API on port 9292",
		  http: "http://localhost:9292/health-check",
		  tls_skip_verify: false,
		  method: "GET",
		  interval: "10s",
		  timeout: "1s"
		}
	}
}.merge( ConsulConfiguration.config[:consul] )

Instance Method Summary collapse

Methods included from ApplicationConfiguration

config

Instance Method Details

#configureObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/consul/consul_configuration.rb', line 25

def configure
	Diplomat.configure do |config|
	  # Set up a custom Consul URL
	  config.url = "#{CONFIG[:path]}:#{CONFIG[:port].to_s}"
	  # Set up a custom Faraday Middleware
	  # config.middleware = MyCustomMiddleware
	  # Connect into consul with custom access token (ACL)
	  # config.acl_token = "qwertyui-asdf-zxcv-1234-123456789012"
	  # Set extra Faraday configuration options
	  # config.options = {ssl: { version: :TLSv1_2 }}
	end

	CONFIG[:consul_service_data]
end