File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed
GradeManagement.Server/Controllers
GradeManagement.Shared/Dtos/GitHubManifest Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -15,8 +15,9 @@ namespace GradeManagement.Server.Controllers;
1515public class GitHubAppController ( IHttpClientFactory httpClientFactory ) : ControllerBase
1616{
1717 [ HttpGet ]
18- public async Task CreateGitHubApp ( [ FromQuery ] string code )
18+ public async Task < IActionResult > CreateGitHubApp ( [ FromQuery ] string code )
1919 {
20+ string appUrl = Environment . GetEnvironmentVariable ( "APP_URL" ) ;
2021 string keyVaultUrl = Environment . GetEnvironmentVariable ( "KEY_VAULT_URI" ) ;
2122 var client = new SecretClient ( new Uri ( keyVaultUrl ) , new DefaultAzureCredential ( ) ) ;
2223 var httpClient = httpClientFactory . CreateClient ( ) ;
@@ -36,6 +37,8 @@ await client.SetSecretAsync($"GitHubMonitorConfig--{gitHubApp.Owner.Login}--GitH
3637 await client . SetSecretAsync ( $ "GitHubMonitorConfig--{ gitHubApp . Owner . Login } --GitHubAppPrivateKey", pem ) ;
3738 await client . SetSecretAsync ( $ "GitHubMonitorConfig--{ gitHubApp . Owner . Login } --GitHubWebhookSecret",
3839 gitHubApp . WebhookSecret ) ;
40+
41+ return Redirect ( appUrl ) ;
3942 }
4043
4144 public static string RemovePemFencing ( string pem )
Original file line number Diff line number Diff line change @@ -4,14 +4,20 @@ namespace GradeManagement.Shared.Dtos.GitHubManifest;
44
55public class GitHubAppManifest
66{
7+ public GitHubAppManifest ( )
8+ {
9+ string appUrl = Environment . GetEnvironmentVariable ( "APP_URL" ) ;
10+ RedirectUrl = $ "{ appUrl } api/github";
11+ }
12+
713 [ JsonPropertyName ( "name" ) ]
814 public string Name { get ; set ; } = "Ahk GitHub Monitor" ;
915 [ JsonPropertyName ( "url" ) ]
1016 public string Url { get ; set ; } = "https://github.com/bmeaut/ahk-github-automation" ;
1117 [ JsonPropertyName ( "hook_attributes" ) ]
12- public HookAttributes HookAttributes { get ; set ; } = new HookAttributes ( ) ;
18+ public HookAttributes HookAttributes { get ; set ; }
1319 [ JsonPropertyName ( "redirect_url" ) ]
14- public string RedirectUrl { get ; set ; } = "https://app.mm-home.eu/api/github" ;
20+ public string RedirectUrl { get ; set ; }
1521 [ JsonPropertyName ( "callback_urls" ) ]
1622 public List < string > CallbackUrls { get ; set ; } = new ( ) ;
1723 /*[JsonPropertyName("setup_url")]
Original file line number Diff line number Diff line change @@ -4,8 +4,14 @@ namespace GradeManagement.Shared.Dtos.GitHubManifest;
44
55public class HookAttributes
66{
7+ public HookAttributes ( )
8+ {
9+ string monitorUrl = Environment . GetEnvironmentVariable ( "MONITOR_URL" ) ;
10+ Url = $ "{ monitorUrl } api/github-webhooks";
11+ }
12+
713 [ JsonPropertyName ( "url" ) ]
8- public string Url { get ; set ; } = "https://monitor.mm-home.eu/api/github-webhooks" ;
14+ public string Url { get ; set ; }
915 [ JsonPropertyName ( "active" ) ]
1016 public bool Active { get ; set ; } = true ;
1117}
You can’t perform that action at this time.
0 commit comments