Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): submit incident #39

Merged
merged 5 commits into from
May 27, 2024
Merged

feat(backend): submit incident #39

merged 5 commits into from
May 27, 2024

Conversation

YogiPristiawan
Copy link
Collaborator

@YogiPristiawan YogiPristiawan commented May 26, 2024

Close #29

  • I am using x-api-key header for security. Therefore, you must add API_KEY to the environment. Let me know, if you have a better solution.

@YogiPristiawan YogiPristiawan requested a review from a team as a code owner May 26, 2024 17:17
@takadev15
Copy link
Collaborator

This is only for submitting incident right?

@YogiPristiawan
Copy link
Collaborator Author

yes

@takadev15
Copy link
Collaborator

looks good to me 👍🏼

backend/http.go Show resolved Hide resolved
backend/incident.go Outdated Show resolved Hide resolved
backend/incident.go Outdated Show resolved Hide resolved
backend/incident.go Outdated Show resolved Hide resolved
backend/main.go Outdated
@@ -53,6 +53,11 @@ func main() {
port = "5000"
}

apiKey, ok := os.LookupEnv("API_KEY")
if !ok {
log.Fatal().Msg("API_KEY is required")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't be Fatal though. Should be a warning that the API_KEY is not set, therefore you can't make API calls to endpoints that requires an API key.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +27 to +29
if incident.Timestamp.After(time.Now()) {
incidentStatus = IncidentStatusScheduled
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@aldy505 aldy505 merged commit 17bd6a6 into master May 27, 2024
3 checks passed
@aldy505 aldy505 deleted the feat/incident-writer branch May 27, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend: Add HTTP endpoint for remotely submitting incident data
3 participants