From 5538c47b3fa5406ef1e4c7ac2e13fed02bebe6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Tue, 5 Sep 2023 12:14:43 +0200 Subject: [PATCH] Improve installation exception when missconfigured --- app/controllers/api/vcs.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/controllers/api/vcs.php b/app/controllers/api/vcs.php index 543a7e6b8b..894e083dfb 100644 --- a/app/controllers/api/vcs.php +++ b/app/controllers/api/vcs.php @@ -228,6 +228,7 @@ App::get('/v1/vcs/github/authorize') ->groups(['api', 'vcs']) ->label('scope', 'vcs.read') ->label('sdk.namespace', 'vcs') + ->label('error', __DIR__ . '/../../views/general/error.phtml') ->label('sdk.auth', [APP_AUTH_TYPE_ADMIN]) ->label('sdk.method', 'createGitHubInstallation') ->label('sdk.description', '') @@ -248,6 +249,11 @@ App::get('/v1/vcs/github/authorize') ]); $appName = App::getEnv('_APP_VCS_GITHUB_APP_NAME'); + + if(empty($appName)) { + throw new Exception(Exception::GENERAL_SERVER_ERROR, 'GitHub App name is not configured. Please configure VCS (Version Control System) variables in .env file.'); + } + $url = "https://github.com/apps/$appName/installations/new?" . \http_build_query([ 'state' => $state, 'redirect_uri' => $request->getProtocol() . '://' . $request->getHostname() . "/v1/vcs/github/callback"