inject variables for middleware