diff --git a/src/core/archive.ml b/src/core/archive.ml index 0cf6dc3..74be170 100644 --- a/src/core/archive.ml +++ b/src/core/archive.ml @@ -13,7 +13,7 @@ module Configuration = struct let of_config config = let open Confix in let open Confix.Config in - let str k = ConfixToml.(string config ("general" / k)) in + let str k = ConfixToml.(string config ("archive" / k)) in try Ok { repository = diff --git a/src/logarion_cli.ml b/src/logarion_cli.ml index f0265e6..feadaa8 100644 --- a/src/logarion_cli.ml +++ b/src/logarion_cli.ml @@ -38,14 +38,33 @@ let init force = ".logarion/html-templates", "templates"; ] in - let copies = [ - "config.toml", ".logarion/"; - "share/static", ".logarion/"; - "share/html_templates", ".logarion/"; - ] + let toml_data = + Random.self_init(); + let open Toml in + let open TomlTypes in + of_key_values [ + key "archive", + TTable ( + of_key_values [ + key "title", TString ""; + key "owner", TString (Bos.OS.Env.opt_var "USER" ""); + key "email", TString (Bos.OS.Env.opt_var "EMAIL" ""); + key "uuid", TString (Meta.Id.(generate () |> to_string)); + ]); + key "web", + TTable ( + of_key_values [ + key "url", TString "http://localhost:3666"; + key "stylesheets", TArray ( NodeString ["main.css"] ); + key "static_dir", TString "share/static"; + ]); + key "templates", TTable (of_key_values []); + ] in create_dirs dirs; - make_copies copies + let config_file = open_out ".logarion/config.toml" in + output_bytes config_file (Toml.Printer.string_of_table toml_data); + close_out config_file let init_term = let force =