funcool

A channel for discussing and asking questions about Funcool libraries https://github.com/funcool/
Yehonathan Sharvit 2017-03-29T05:27:28.638397Z

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

Yehonathan Sharvit 2017-03-29T07:54:47.878641Z

@niwinz maybe you can help ?

Yehonathan Sharvit 2017-03-29T17:28:11.819896Z

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

dm3 2017-03-29T18:57:12.739636Z

isn’t a request there just a map?

dm3 2017-03-29T18:57:38.749224Z

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

Yehonathan Sharvit 2017-03-29T19:16:16.137549Z

there is a request which is a map

Yehonathan Sharvit 2017-03-29T19:16:20.139276Z

but no ip there

Yehonathan Sharvit 2017-03-29T19:17:07.155059Z

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

Yehonathan Sharvit 2017-03-29T19:18:02.173572Z

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

johanatan 2017-03-29T19:51:23.828501Z

hi

johanatan 2017-03-29T19:51:47.836118Z

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

johanatan 2017-03-29T19:51:55.838896Z

[sorry, warning]

johanatan 2017-03-29T19:52:06.842691Z

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

johanatan 2017-03-29T19:52:21.847870Z

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))

johanatan 2017-03-29T19:52:43.854700Z

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

johanatan 2017-03-29T19:52:57.859342Z

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

dm3 2017-03-29T20:34:46.692174Z

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

dm3 2017-03-29T20:36:18.722700Z

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

johanatan 2017-03-29T20:36:20.723192Z

@dm3 is the bug reported anywhere?

dm3 2017-03-29T20:36:26.725365Z

no idea