app.lua 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. -- Application configuration.
  2. local plpath = require "pl.path"
  3. local ROOT = os.getenv("PKAR_ROOT")
  4. if not ROOT then
  5. print(
  6. "PKAR_ROOT environment variable is not set.\n" ..
  7. "Data will be written to a TEMPORARY location that " ..
  8. "may NOT SURVIVE a reboot!"
  9. )
  10. ROOT = "/tmp/pocket_archive"
  11. end
  12. return {
  13. id = {
  14. -- Length in ASCII characters of system-generated IDs.
  15. len = 16,
  16. -- Two seeds for the random ID generator.
  17. seed = {256, 512},
  18. },
  19. md = {
  20. -- Single-valued fields. TODO rely on content model cardinality.
  21. single_values = {
  22. ["content_type"] = true,
  23. ["label"] = true,
  24. ["archive_path"] = true,
  25. ["source_path"] = true,
  26. },
  27. -- Map of data types in prop definitions to RDF literal types.
  28. -- Non-mapped items are set to `xsd:string`.
  29. datatypes = {
  30. integer = "xsd:integer",
  31. decimal = "xsd:decimal",
  32. float = "xsd:double",
  33. boolean = "xsd:boolean",
  34. datetime = "xsd:datetime",
  35. }
  36. },
  37. fs = {
  38. -- Base path to write opaque resources.
  39. ores_path = os.getenv("PKAR_ORES") or plpath.join(ROOT, "data", "ores"),
  40. -- Base path of LSUP store for descriptive resources (RDF).
  41. dres_path = os.getenv("PKAR_DRES") or plpath.join(ROOT, "data", "dres"),
  42. -- How many bytes to read when handling files. Adjust to memory
  43. -- availability.
  44. stream_chunk_size = 1024 ^ 2, -- 1Mb
  45. },
  46. -- Namespace prefixes to populate the Pocket Archive NS map.
  47. namespace = {
  48. b2 = "urn:blake2:",
  49. dc = "http://purl.org/dc/terms/",
  50. foaf = "http://xmlns.com/foaf/0.1/",
  51. par = "urn:pkar:resource/",
  52. pas = "http://id.pkar.knowledgetx.com/schema#",
  53. premis = "http://id.loc.gov/vocabulary/preservation/",
  54. rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
  55. rdfs = "http://www.w3.org/2000/01/rdf-schema#",
  56. xsd = "http://www.w3.org/2001/XMLSchema#",
  57. },
  58. -- Static and dynamic site settings.
  59. site = {
  60. title = "Pocket Archive demo site"
  61. },
  62. -- Static site generation settings.
  63. htmlgen = {
  64. out_dir = plpath.join(ROOT, "out", "html"),
  65. max_homepage_items = 12,
  66. },
  67. }