Fork me on GitHub
#duct
<
2017-11-08
>
h.elmougy15:11:50

should I also use the Boundary protocol for restful clients?

h.elmougy15:11:29

any equivalent protocol for rest client?

rickmoynihan17:11:12

@weavejester: any idea how to override /robots.txt overriding a dynamic one in our app? We can’t seem to get the incantation right to stomp over https://github.com/duct-framework/module.web/blob/master/src/duct/module/web.clj#L107 in the config

weavejester17:11:10

@rickmoynihan You should just be able to put your own robots.txt in your public resources directory.

rickmoynihan17:11:37

@weavejester: we need to generate it dynamically from the database

rickmoynihan17:11:11

and wrap-resource’s precedence is higher than the handlers

weavejester17:11:35

@rickmoynihan Then you should just be able to set up a route with that. Your routes should override the static resources, and your static resources should override Duct’s defaults.

weavejester17:11:25

@rickmoynihan Hm, I guess I’m getting confused between Compojure and Ring’s implementations.

weavejester17:11:49

In which case, you should just be able to override the :defaults config…

weavejester17:11:07

Let me check…

rickmoynihan17:11:06

yeah, I was pretty surprised that ring resources override routes; I expected routes to take precedence and resources to be a fallback

weavejester17:11:48

@rickmoynihan I believe it’s because Ring doesn’t view nil handlers as not matching.

weavejester17:11:06

Though it could check 404…

rickmoynihan17:11:11

hmm hadn’t realised that, interesting

rickmoynihan17:11:36

so the nil 404 convention is a layer above ring?

weavejester17:11:17

Yeah, it’s a Compojure thing

weavejester17:11:37

Okay, so I’ve just checked, and this works:

weavejester17:11:40

:duct.middleware.web/defaults
 {:static {:resources ^:replace ["foo/public"]}}

weavejester17:11:03

Add the :replace metadata allows you to override the static resource paths.

rickmoynihan17:11:31

hmm… ok, actually asking on behalf of a colleague — who has gone home now… and we had him try exactly that ^:replace thing and he said it didn’t work

rickmoynihan17:11:47

but both remote today, so hard to say for sure

weavejester17:11:04

Are you using the latest duct/module.web version?

rickmoynihan17:11:16

we’re currently on an older release

rickmoynihan17:11:24

we have a ticket to upgrade 🙂

weavejester17:11:25

I think there was a bug in an earlier version that overrode bits it shouldn’t.

rickmoynihan17:11:38

ok that’s what we’re seeing.

rickmoynihan17:11:43

will check the version…

weavejester17:11:18

What version are you using, btw?

rickmoynihan17:11:47

[integrant "0.6.1"] ;; can remove when we update duct 
                           [duct/core "0.5.0"]
                           [duct/logger.timbre "0.2.0"]
                           [duct/compiler.cljs "0.1.2"]
                           [duct/server.figwheel "0.1.3"]
                           [duct/module.web "0.5.4" :exclusions [org.slf4j/slf4j-api org.slf4j/slf4j-nop]]
                           [duct/module.ataraxy "0.1.7"]
                           
                           ;; Logging dependencies

[duct/module.logging "0.2.0" :exclusions [org.slf4j/slf4j-api]]

weavejester17:11:49

According to the changelog, that version postdates some of the fixes I made in the module config merging.

weavejester17:11:12

However, other dependencies updates might have fixed bugs not listed in the changelog

weavejester17:11:35

And I can override robots.txt on a sample project I just created

weavejester17:11:22

@rickmoynihan If the version update doesn’t fix it, ping me 🙂

rickmoynihan17:11:34

haha will do 🙂

rickmoynihan17:11:47

thanks for the help 🙂

weavejester17:11:02

I’ll also add a note to add an option to wrap-resource to allow overriding by routes.

weavejester17:11:18

To maintain backward compatibility it’ll need to be an option

rickmoynihan17:11:25

yeah that would fantastic

weavejester17:11:26

But in Duct it can be activated by default