diff --git a/bin/builder_system.ml b/bin/builder_system.ml index 3ac2767..0c3bd1c 100644 --- a/bin/builder_system.ml +++ b/bin/builder_system.ml @@ -11,9 +11,6 @@ let default_datadir = | `FreeBSD -> "/var/db/builder-web" | `Linux -> "/var/lib/builder-web" -let default_cachedir = - default_datadir ^ "/_cache" - let default_configdir = match Lazy.force uname with | `FreeBSD -> "/usr/local/etc/builder-web" diff --git a/bin/builder_web_app.ml b/bin/builder_web_app.ml index fca18df..d2dfcdc 100644 --- a/bin/builder_web_app.ml +++ b/bin/builder_web_app.ml @@ -81,7 +81,10 @@ let init_influx name data = let setup_app level influx port host datadir cachedir configdir = let dbpath = Printf.sprintf "%s/builder.sqlite3" datadir in let datadir = Fpath.v datadir in - let cachedir = Fpath.v cachedir in + let cachedir = match cachedir with + | Some c -> Fpath.v c + | None -> Fpath.(datadir / "_cache") + in let configdir = Fpath.v configdir in let () = init_influx "builder-web" influx in match Builder_web.init dbpath datadir with @@ -130,7 +133,11 @@ let datadir = let cachedir = let doc = "cache directory" in - Arg.(value & opt dir Builder_system.default_cachedir & info [ "cachedir" ] ~doc) + Arg.( + value + & opt (some ~none:"DATADIR/_cache" dir) None + & info [ "cachedir" ] ~doc + ) let configdir = let doc = "config directory" in