let flags_of_string s =
string_fold_left (fun l c -> l @ flag_of_char c) [] s
-let init myflags mylog =
+let init ?(flags = []) mylog =
+ let flags =
+ if flags = [] then
+ flags_of_string (Helm_registry.get "mathql_interpreter.flags")
+ else
+ flags
+ in
let m, a =
let g =
- if List.mem Galax myflags
+ if List.mem Galax flags
then MQIMap.empty_map else MQIMap.read_map
in g ()
in
- {log = mylog; set = myflags;
+ {log = mylog; set = flags;
pgc =
- if List.mem Galax myflags then
+ if List.mem Galax flags then
None
else
MQIPostgres.init
let connected handle =
if set handle Galax then false else (pgc handle) <> None
-let init_if_connected myflags mylog =
- let handle = init myflags mylog in
+let init_if_connected ?(flags = []) mylog =
+ let handle = init ~flags:flags mylog in
ignore (pgc handle); handle