app.lua 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. --[[ Seed for the random ID generator.
  17. Set this to an arbitrary integer in a test environment, so that
  18. resource IDs will be generated with a consistent pattern for each run
  19. (not when using pkar_watch, though). Note that each call to e.g.
  20. `pkar deposit` will generate IDs starting from the same seed and will
  21. overwrite resources from a previous deposit.
  22. If nil, os.time() will be used, which generates always different random
  23. IDs. This is necessary in a real-world application to avoid the above
  24. mentioned overwriting.
  25. ]]
  26. seed = nil,
  27. },
  28. md = {
  29. -- Single-valued fields. TODO rely on content model cardinality.
  30. single_values = {
  31. ["content_type"] = true,
  32. ["label"] = true,
  33. ["archive_path"] = true,
  34. ["source_path"] = true,
  35. },
  36. -- Map of data types in prop definitions to RDF literal types.
  37. -- Non-mapped items are set to `xsd:string`.
  38. datatypes = {
  39. integer = "xsd:integer",
  40. decimal = "xsd:decimal",
  41. float = "xsd:double",
  42. boolean = "xsd:boolean",
  43. datetime = "xsd:datetime",
  44. }
  45. },
  46. fs = {
  47. -- Base path to write opaque resources.
  48. ores_path = os.getenv("PKAR_ORES") or plpath.join(ROOT, "data", "ores"),
  49. -- Base path of LSUP store for descriptive resources (RDF).
  50. dres_path = os.getenv("PKAR_DRES") or plpath.join(ROOT, "data", "dres"),
  51. -- How many bytes to read when handling files. Adjust to memory
  52. -- availability.
  53. stream_chunk_size = 1024 ^ 2, -- 1Mb
  54. },
  55. -- Namespace prefixes to populate the Pocket Archive NS map.
  56. namespace = {
  57. b2 = "urn:blake2:",
  58. dc = "http://purl.org/dc/terms/",
  59. foaf = "http://xmlns.com/foaf/0.1/",
  60. par = "urn:pkar:resource/",
  61. pas = "http://id.pkar.knowledgetx.com/schema#",
  62. premis = "http://id.loc.gov/vocabulary/preservation/",
  63. rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
  64. rdfs = "http://www.w3.org/2000/01/rdf-schema#",
  65. xsd = "http://www.w3.org/2001/XMLSchema#",
  66. },
  67. -- Static and dynamic site settings.
  68. site = {
  69. title = "Pocket Archive demo site"
  70. },
  71. -- Static site generation settings.
  72. htmlgen = {
  73. out_dir = plpath.join(ROOT, "out", "html"),
  74. max_homepage_items = 12,
  75. },
  76. }