Removes Wild Cloud cruft.
This commit is contained in:
@@ -80,41 +80,4 @@ func RequestLoggingMiddleware(next http.Handler) http.Handler {
|
||||
})
|
||||
}
|
||||
|
||||
// contextKey is a type for context keys to avoid collisions.
|
||||
type contextKey string
|
||||
|
||||
// Context keys for request values.
|
||||
const (
|
||||
InstanceNameKey contextKey = "instanceName"
|
||||
AppNameKey contextKey = "appName"
|
||||
NodeNameKey contextKey = "nodeName"
|
||||
)
|
||||
|
||||
|
||||
// GetInstanceName returns the instance name from request context.
|
||||
// Falls back to mux.Vars if not in context (for backward compatibility during migration).
|
||||
func GetInstanceName(r *http.Request) string {
|
||||
if name, ok := r.Context().Value(InstanceNameKey).(string); ok {
|
||||
return name
|
||||
}
|
||||
return mux.Vars(r)["name"]
|
||||
}
|
||||
|
||||
// GetAppName returns the app name from request context.
|
||||
// Falls back to mux.Vars if not in context.
|
||||
func GetAppName(r *http.Request) string {
|
||||
if name, ok := r.Context().Value(AppNameKey).(string); ok {
|
||||
return name
|
||||
}
|
||||
return mux.Vars(r)["app"]
|
||||
}
|
||||
|
||||
// GetNodeName returns the node name from request context.
|
||||
// Falls back to mux.Vars if not in context.
|
||||
func GetNodeName(r *http.Request) string {
|
||||
if name, ok := r.Context().Value(NodeNameKey).(string); ok {
|
||||
return name
|
||||
}
|
||||
return mux.Vars(r)["node"]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user