Fork me on GitHub
#funcool
<
2017-03-29
>
Yehonathan Sharvit05:03:28

In catacumba, how could I receive the ip of an http request?

Yehonathan Sharvit07:03:47

@niwinz maybe you can help ?

Yehonathan Sharvit17:03:11

Can somebody help me with this: In catacumba, how can I retrieve the ip of an http request?

dm318:03:12

isn’t a request there just a map?

dm318:03:38

does it have a remote-host key or something like that?

Yehonathan Sharvit19:03:16

there is a request which is a map

Yehonathan Sharvit19:03:07

there is {:catacumba/context #object[ratpack.handling.internal.DefaultContext 0x72d25b“ratpack.handling.internal.DefaultContext@72d25b”}] inside the request map

Yehonathan Sharvit19:03:02

@dm3 maybe from the ratpack DafaultContext object, we can get the ip?

johanatan19:03:47

I'm getting a weird error from a for nested within an alet

johanatan19:03:55

[sorry, warning]

johanatan19:03:06

WARNING: Can't take value of macro cljs.core/for at line 133 src/speako/backend.cljs
WARNING: Use of undeclared Var speako.backend/entity at line 133 src/speako/backend.cljs
WARNING: Use of undeclared Var speako.backend/fields at line 133 src/speako/backend.cljs
nil

johanatan19:03:21

here's the relevant form:

(p/alet [entities (:objects parsed)
            promises (for [[entity fields] entities]
                       (p/alet [table-name (entity->table-name entity)
                                columns-meta (p/await (table->columns table-name db))]
                               (scalar-columns-exist? table-name fields columns-meta db)))
            res (p/await (p/all promises))]
           (every? identity res))

johanatan19:03:43

the code actually works at runtime but I'm more of a "zero warning" kind of guy

johanatan19:03:57

and would like to avoid this warning without resulting to changing the for to a map

dm320:03:46

johanatan: that’s a bug in alet, you can try tackling if you’re feeling adventurous 🙂

dm320:03:18

@viebel did you try (.getRemoteHost (.getRequest context)) ?

johanatan20:03:20

@dm3 is the bug reported anywhere?