diff options
Diffstat (limited to 'mod/mod-ci-github.cxx')
-rw-r--r-- | mod/mod-ci-github.cxx | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index e008314..139be68 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -77,25 +77,20 @@ namespace brep // Prepare for the CI requests handling, if configured. // - // @@ TMP Shouldn't we be checking options_->ci_data_specified () like - // mod-ci does? - // - if (options_->build_config_specified () && - options_->ci_github_app_webhook_secret_specified ()) + if (options_->ci_github_app_webhook_secret_specified ()) { + if (!options_->build_config_specified ()) + fail << "package building functionality must be enabled"; + if (!options_->ci_github_app_id_private_key_specified ()) fail << "no app id/private key mappings configured"; for (const auto& pr: options_->ci_github_app_id_private_key ()) { if (pr.second.relative ()) - fail << "ci-github-app-id-private-key paths must be absolute"; + fail << "ci-github-app-id-private-key path must be absolute"; } - ci_start::init (make_shared<options::ci_start> (*options_)); - - database_module::init (*options_, options_->build_db_retry ()); - // Read the webhook secret from the configured path. // { @@ -107,16 +102,20 @@ namespace brep try { ifdstream is (p); - getline (is, webhook_secret_); + getline (is, webhook_secret_, '\0'); if (webhook_secret_.empty ()) - fail << "empty webhook secret read from " << p; + fail << "empty webhook secret in " << p; } catch (const io_error& e) { - fail << "unable to read webhook secret file " << p << ": " << e; + fail << "unable to read webhook secret from " << p << ": " << e; } } + + ci_start::init (make_shared<options::ci_start> (*options_)); + + database_module::init (*options_, options_->build_db_retry ()); } } |