call validate_config from after_initialize
This commit is contained in:
parent
aff5de85f9
commit
827aac03cf
2 changed files with 11 additions and 4 deletions
|
|
@ -34,12 +34,12 @@ module DiasporaFederation
|
|||
# end
|
||||
def configure
|
||||
yield self
|
||||
validate_config
|
||||
logger.info "successfully configured the federation engine"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
# validates if the engine is configured correctly
|
||||
#
|
||||
# called from after_initialize
|
||||
def validate_config
|
||||
raise ConfigurationError, "missing server_uri" unless @server_uri.respond_to? :host
|
||||
validate_class(@person_class, "person_class", %i(
|
||||
|
|
@ -53,8 +53,11 @@ module DiasporaFederation
|
|||
profile_url
|
||||
hcard_url
|
||||
))
|
||||
logger.info "successfully configured the federation engine"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def validate_class(klass, name, methods)
|
||||
raise ConfigurationError, "missing #{name}" unless klass
|
||||
const = const_get(klass)
|
||||
|
|
|
|||
|
|
@ -7,5 +7,9 @@ module DiasporaFederation
|
|||
config.generators do |g|
|
||||
g.test_framework :rspec
|
||||
end
|
||||
|
||||
config.after_initialize do
|
||||
DiasporaFederation.validate_config
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue