Skip to content

Commit dc6c3b8

Browse files
committed
feat: gate api on feature flag
1 parent cc246e2 commit dc6c3b8

File tree

2 files changed

+24
-23
lines changed

2 files changed

+24
-23
lines changed

dev/clj/config.edn

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{;; :password "SuchWow"
22
;; :in-memory? true
3-
:fluree {:servers ["http://localhost:8090"]}
4-
:datascript {:persist-base-path "./athens-data/datascript/persist/"}
5-
:nrepl {:port 8877}}
3+
:fluree {:servers ["http://localhost:8090"]}
4+
:datascript {:persist-base-path "./athens-data/datascript/persist/"}
5+
:nrepl {:port 8877}
6+
:feature-flags {:api true}}

src/clj/athens/self_hosted/web/api.clj

+20-20
Original file line numberDiff line numberDiff line change
@@ -103,30 +103,30 @@
103103
(defn make-routes
104104
[datascript fluree config]
105105
(let [conn (:conn datascript)
106-
;; TODO: only if config ff is on
107106
;; TODO: handle pw
108107
;; password (-> config :config :password)
109108
]
110-
111-
(->
112-
(c/routes
109+
(if-not (-> config :config :feature-flags :api)
110+
(c/routes)
111+
(->
112+
(c/routes
113113
(c/context
114-
"/api/path" []
115-
116-
(c/POST
117-
"/read" {{:keys [path]} :body-params}
118-
(->> path
119-
(read-path conn)
120-
ok))
121-
122-
(c/POST
123-
"/write" {{:keys [path relation data]} :body-params}
124-
(->> (write-in-path-evt conn path relation data)
125-
(process-event! datascript fluree config)
126-
(ret-first path)
127-
(read-path conn)
128-
ok))))
129-
muuntaja.mw/wrap-format)))
114+
"/api/path" []
115+
116+
(c/POST
117+
"/read" {{:keys [path]} :body-params}
118+
(->> path
119+
(read-path conn)
120+
ok))
121+
122+
(c/POST
123+
"/write" {{:keys [path relation data]} :body-params}
124+
(->> (write-in-path-evt conn path relation data)
125+
(process-event! datascript fluree config)
126+
(ret-first path)
127+
(read-path conn)
128+
ok))))
129+
muuntaja.mw/wrap-format))))
130130

131131

132132
;; curl examples

0 commit comments

Comments
 (0)