lib/avrolution/configuration.rb in avrolution-0.2.0 vs lib/avrolution/configuration.rb in avrolution-0.3.0
- old
+ new
@@ -1,8 +1,9 @@
module Avrolution
COMPATIBILITY_SCHEMA_REGISTRY_URL = 'COMPATIBILITY_SCHEMA_REGISTRY_URL'.freeze
+ DEPLOYMENT_SCHEMA_REGISTRY_URL = 'DEPLOYMENT_SCHEMA_REGISTRY_URL'.freeze
class << self
# Root directory to search for schemas, and default location for
# compatibility breaks file
attr_writer :root
@@ -13,10 +14,14 @@
# The URL (including any Basic Auth) for the schema registry to use for
# compatibility checks
attr_writer :compatibility_schema_registry_url
+ # The URL (including any Basic Auth) for the schema registry to use for
+ # deployment
+ attr_writer :deployment_schema_registry_url
+
attr_accessor :logger
end
self.logger = Avrolution::PassthruLogger.new($stdout)
@@ -27,12 +32,17 @@
def self.compatibility_breaks_file
@compatibility_breaks_file ||= "#{root}/avro_compatibility_breaks.txt"
end
def self.compatibility_schema_registry_url
- @compatibility_schema_registry_url ||= begin
- raise 'compatibility_schema_registry_url must be set' unless ENV[COMPATIBILITY_SCHEMA_REGISTRY_URL]
- ENV[COMPATIBILITY_SCHEMA_REGISTRY_URL]
+ @compatibility_schema_registry_url ||= ENV.fetch(COMPATIBILITY_SCHEMA_REGISTRY_URL) do
+ raise 'compatibility_schema_registry_url must be set'
+ end
+ end
+
+ def self.deployment_schema_registry_url
+ @deployment_schema_registry_url ||= ENV.fetch(DEPLOYMENT_SCHEMA_REGISTRY_URL) do
+ raise 'deployment_schema_registry_url must be set'
end
end
def self.configure
yield self