objective categorical abstract machine language personal data server
65
fork

Configure Feed

Select the types of activity you want to include in your feed.

Don't create db by default

futurGH af31e228 367e247f

+13 -7
+1 -1
bin/main.ml
··· 53 53 , Api.Actor.PutPreferences.handler ) ] 54 54 55 55 let main = 56 - let%lwt db = Data_store.connect () in 56 + let%lwt db = Data_store.connect ~create:true () in 57 57 let%lwt () = Data_store.init db in 58 58 Dream.serve ~interface:"0.0.0.0" ~port:8008 59 59 @@ Dream.logger
+2 -2
pegasus/lib/data_store.ml
··· 189 189 190 190 type t = (module Rapper_helper.CONNECTION) 191 191 192 - let connect () : t Lwt.t = 193 - Util.connect_sqlite Util.Constants.pegasus_db_location 192 + let connect ?create ?write () : t Lwt.t = 193 + Util.connect_sqlite ?create ?write Util.Constants.pegasus_db_location 194 194 195 195 let init conn : unit Lwt.t = unwrap @@ Queries.create_tables conn 196 196
+4 -2
pegasus/lib/user_store.ml
··· 299 299 300 300 type t = {did: string; db: (module Rapper_helper.CONNECTION)} 301 301 302 - let connect did : t Lwt.t = 303 - let%lwt db = Util.connect_sqlite (Util.Constants.user_db_location did) in 302 + let connect ?create ?write did : t Lwt.t = 303 + let%lwt db = 304 + Util.connect_sqlite ?create ?write (Util.Constants.user_db_location did) 305 + in 304 306 Lwt.return {did; db} 305 307 306 308 let init t : unit Lwt.t =
+6 -2
pegasus/lib/util.ml
··· 185 185 Lwt.return conn 186 186 187 187 (* opens an sqlite connection *) 188 - let connect_sqlite db_uri = 189 - match%lwt Caqti_lwt_unix.connect db_uri with 188 + let connect_sqlite ?(create = false) ?(write = true) db_uri = 189 + let uri = 190 + Uri.add_query_params' db_uri 191 + [("create", string_of_bool create); ("write", string_of_bool write)] 192 + in 193 + match%lwt Caqti_lwt_unix.connect uri with 190 194 | Ok c -> 191 195 _init_connection c 192 196 | Error e ->