moved check to config.go

This commit is contained in:
Parminder Singh 2019-08-15 15:48:04 +05:30
parent 4438ae62b6
commit 2a8541e47f
2 changed files with 5 additions and 11 deletions

View file

@ -44,17 +44,6 @@ func SetupClientAPIComponent(
asAPI appserviceAPI.AppServiceQueryAPI,
transactionsCache *transactions.Cache,
) {
if base.Cfg.Matrix.RecaptchaEnabled &&
(base.Cfg.Matrix.RecaptchaPublicKey == "" ||
base.Cfg.Matrix.RecaptchaPrivateKey == "" ||
base.Cfg.Matrix.RecaptchaSiteVerifyAPI == "") {
logrus.Panicf(
"Recaptcha configs are missing. " +
"Ensure that recaptcha_public_key, recaptcha_private_key and " +
"recaptcha_siteverify_api are specified",
)
}
roomserverProducer := producers.NewRoomserverProducer(inputAPI)
typingProducer := producers.NewTypingServerProducer(typingInputAPI)

View file

@ -498,6 +498,11 @@ func (config *Dendrite) checkMatrix(configErrs *configErrors) {
checkNotEmpty(configErrs, "matrix.server_name", string(config.Matrix.ServerName))
checkNotEmpty(configErrs, "matrix.private_key", string(config.Matrix.PrivateKeyPath))
checkNotZero(configErrs, "matrix.federation_certificates", int64(len(config.Matrix.FederationCertificatePaths)))
if config.Matrix.RecaptchaEnabled {
checkNotEmpty(configErrs, "matrix.recaptcha_public_key", string(config.Matrix.RecaptchaPublicKey))
checkNotEmpty(configErrs, "matrix.recaptcha_private_key", string(config.Matrix.RecaptchaPrivateKey))
checkNotEmpty(configErrs, "matrix.recaptcha_siteverify_api", string(config.Matrix.RecaptchaSiteVerifyAPI))
}
}
// checkMedia verifies the parameters media.* are valid.