graphql

emccue 2020-10-03T15:27:35.009Z

How would I add some "auth required" to lacinia pedestal subscriptions?

emccue 2020-10-03T15:28:15.009400Z

its pretty easy with routing, since I can just inject something

emccue 2020-10-03T15:28:40.010Z

but I am reloading the compiled schema on every request in dev

emccue 2020-10-03T15:28:57.010300Z

(defn routes [{:keys [config] :as system}]
  (route/expand-routes
    (set/union
      #{["/api/v1/signup" :post `auth/sign-up :route-name ::sign-up-route]
        ["/api/v1/login" :post `auth/log-in :route-name ::log-in-route]
        ["/api/v1/logout" :post `auth/log-out :route-name ::log-out-route]
        ["/api/v1/photos/:name" :get [`auth/requires-auth-interceptor `photo-route] :route-name ::photo-route]
        ["/api/v1/graphql" :post
         (-> (lp/default-interceptors (graphql/compiled-schema) nil)

emccue 2020-10-03T15:30:18.010600Z

::http/routes (if (config/production? config)
                         (routes system)
                         (fn [] (routes system)))

emccue 2020-10-03T15:30:39.011100Z

but it seems like to add subscriptions i need to wrap the whole service map

emccue 2020-10-03T15:30:54.011400Z

with (lp/enable-subscriptions)

emccue 2020-10-03T15:31:16.011900Z

which won't reload, and would have a different compiled schema instance

emccue 2020-10-03T15:33:39.012500Z

I can accept needing to reload the server to see changes in subscriptions

emccue 2020-10-03T15:33:51.012900Z

but will having a different compiled schema break stuff (horribly)?