Skip to content

Commit

Permalink
Fix generated spec. Add startup logging
Browse files Browse the repository at this point in the history
  • Loading branch information
augustuswm committed Nov 6, 2023
1 parent c6b743f commit 97d64b0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
12 changes: 8 additions & 4 deletions rfd-api-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -2287,12 +2287,17 @@
}
},
"head_commit": {
"$ref": "#/components/schemas/GitHubCommit"
"nullable": true,
"allOf": [
{
"$ref": "#/components/schemas/GitHubCommit"
}
]
},
"installation": {
"$ref": "#/components/schemas/GitHubInstallation"
},
"ref_": {
"ref": {
"type": "string"
},
"repository": {
Expand All @@ -2304,9 +2309,8 @@
},
"required": [
"commits",
"head_commit",
"installation",
"ref_",
"ref",
"repository",
"sender"
]
Expand Down
14 changes: 12 additions & 2 deletions rfd-api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
ServerLogFormat::Pretty => subscriber.pretty().init(),
};

tracing::info!("Initialized logger");

let mut context = ApiContext::new(
config.public_url,
Arc::new(
Expand All @@ -79,9 +81,13 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
)
.await?;

tracing::info!("Configured server context");

let init_data = InitialData::new(config.initial_mappers.map(|p| vec![p]))?;
init_data.initialize(&context).await?;

tracing::info!("Loaded initial data");

if let Some(github) = config.authn.oauth.github {
context.insert_oauth_provider(
OAuthProviderName::GitHub,
Expand All @@ -93,7 +99,9 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
github.web.client_secret.clone(),
))
}),
)
);

tracing::info!("Added GitHub OAuth provider");
}

if let Some(google) = config.authn.oauth.google {
Expand All @@ -107,7 +115,9 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
google.web.client_secret.clone(),
))
}),
)
);

tracing::info!("Added Google OAuth provider");
}

tracing::debug!(?config.spec, "Spec configuration");
Expand Down

0 comments on commit 97d64b0

Please sign in to comment.