Sha256: bce87b3cfa79b27a8c2b1a3de399e5c3325d2fabe7f4d8330b7b39e815b2005f

Contents?: true

Size: 713 Bytes

Versions: 5

Compression:

Stored size: 713 Bytes

Contents

require 'odania/version'
require 'diplomat'

module Odania
	autoload :Consul, 'odania/consul'
	autoload :Service, 'odania/service'
	autoload :Plugin, 'odania/plugin'

	def self.service
		if @service.nil?
			Odania.configure
			@service = Service.new
		end
		@service
	end

	def self.plugin
		Odania.configure
		@plugin = Plugin.new if @plugin.nil?
		@plugin
	end

	def self.configure(consul_url=nil)
		if @configured.nil?
			consul_url = "http://#{ENV['CONSUL_PORT_8500_TCP_ADDR']}:#{ENV['CONSUL_PORT_8500_TCP_PORT']}" if consul_url.nil?
			puts "Consul URL: #{consul_url}"
			Diplomat.configure do |config|
				# Set up a custom Consul URL
				config.url = consul_url
			end
			@configured = true
		end
	end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
odania-0.0.7 lib/odania.rb
odania-0.0.6 lib/odania.rb
odania-0.0.5 lib/odania.rb
odania-0.0.4 lib/odania.rb
odania-0.0.3 lib/odania.rb