Closed armada45-pixel closed 3 weeks ago
Blocking on https://github.com/oven-sh/bun/issues/6613
import { Elysia } from "elysia";
const app = new Elysia({
name: "mainApp",
serve: {
port: 8082,
},
cookie: {
sign: true, // If false requestIP return object of socketAddress
secrets: process.env.COOKIE_KEY || "ok",
},
})
.use((app) =>
app.derive(({ request }) => ({
ip: app.server?.requestIP(request)?.address,
}))
)
.derive({ as: "global" }, ({ cookie: { someMilk } }) => ({
get milkType() {
const value = "chocolate milk";
someMilk.set({
value: value,
});
return value;
},
}))
.get("/", ({ ip }) => {
return ip + "some message";
})
.listen({}, ({ development, hostname, port }) => {
console.log(
`🦊 Elysia is running at ${hostname}:${port} ${
development ? "🚧 in development mode!🚧" : ""
}`
);
});
Wait for testing.
What version of Elysia.JS is running?
1.0.21
What platform is your computer?
Alpine Linux v3.18
onDocker 4.30.0 ( Desktop )
onWSL version: 2.1.5.0
onMicrosoft Windows NT 10.0.22631.0 x64
What steps can reproduce the bug?
when have cookie need to sign,
socketAddress
fromrequestIP
will return willWhat is the expected behavior?
requestIP return normal socketAddress object
What do you see instead?
null
Additional information