Skip to content

Commit

Permalink
Merge pull request #802 from Icinga/EnvironmentFromContext
Browse files Browse the repository at this point in the history
Shorten icingadb/v1.EnvironmentFromContext()
  • Loading branch information
julianbrost authored Sep 9, 2024
2 parents 1092ba4 + c5a0d87 commit 1a1ab60
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/icingadb/v1/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,8 @@ func (e *Environment) Meta() *EnvironmentMeta {
// // Error handling.
// }
func EnvironmentFromContext(ctx context.Context) (*Environment, bool) {
if e, ok := ctx.Value(environmentContextKey).(*Environment); ok {
return e, true
}

return nil, false
e, ok := ctx.Value(environmentContextKey).(*Environment)
return e, ok
}

// environmentContextKey is the key for Environment values in contexts.
Expand Down

0 comments on commit 1a1ab60

Please sign in to comment.