app.lua 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. -- Application configuration.
  2. local plpath = require "pl.path"
  3. local ROOT = os.getenv("PKAR_ROOT")
  4. if not ROOT then
  5. io.output(io.stderr)
  6. io.write(
  7. "PKAR_ROOT environment variable is not set.\n" ..
  8. "Data will be written to a TEMPORARY location that " ..
  9. "may NOT SURVIVE a reboot!"
  10. )
  11. ROOT = "/tmp/pocket_archive"
  12. end
  13. return {
  14. id = {
  15. -- Length in ASCII characters of system-generated IDs.
  16. len = 16,
  17. --[[ Seed for the random ID generator.
  18. Set this to an arbitrary integer in a test environment, so that
  19. resource IDs will be generated with a consistent pattern for each run
  20. (not when using pkar_watch, though). Note that each call to e.g.
  21. `pkar deposit` will generate IDs starting from the same seed and will
  22. overwrite resources from a previous deposit.
  23. If nil, os.time() will be used, which generates always different random
  24. IDs. This is necessary in a real-world application to avoid the above
  25. mentioned overwriting.
  26. ]]
  27. seed = nil,
  28. },
  29. md = {
  30. -- Single-valued fields. TODO rely on content model cardinality.
  31. single_values = {
  32. ["content_type"] = true,
  33. ["label"] = true,
  34. ["archive_path"] = true,
  35. ["source_path"] = true,
  36. },
  37. -- Map of data types in prop definitions to RDF literal types.
  38. -- Non-mapped items are set to `xsd:string`.
  39. datatypes = {
  40. integer = "xsd:integer",
  41. decimal = "xsd:decimal",
  42. float = "xsd:double",
  43. boolean = "xsd:boolean",
  44. datetime = "xsd:datetime",
  45. }
  46. },
  47. fs = {
  48. -- Base path to write opaque resources.
  49. ores_path = os.getenv("PKAR_ORES") or plpath.join(ROOT, "data", "ores"),
  50. -- Base path of LSUP store for descriptive resources (RDF).
  51. dres_path = os.getenv("PKAR_DRES") or plpath.join(ROOT, "data", "dres"),
  52. -- How many bytes to read when handling files. Adjust to memory
  53. -- availability.
  54. stream_chunk_size = 1024 ^ 2, -- 1Mb
  55. },
  56. -- Namespace prefixes to populate the Pocket Archive NS map.
  57. namespace = {
  58. b2 = "blake2:",
  59. dc = "http://purl.org/dc/terms/",
  60. foaf = "http://xmlns.com/foaf/0.1/",
  61. par = "http://id.pkar.knowledgetx.com/resource/",
  62. pas = "http://id.pkar.knowledgetx.com/schema#",
  63. premis = "http://id.loc.gov/vocabulary/preservation/",
  64. rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
  65. rdfs = "http://www.w3.org/2000/01/rdf-schema#",
  66. sub = "http://id.pkar.knowledgetx.com/submission/",
  67. xsd = "http://www.w3.org/2001/XMLSchema#",
  68. },
  69. -- Static site (presentation) generation settings.
  70. pres_gen = {
  71. title = "Pocket Archive demo site",
  72. out_dir = plpath.join(ROOT, "out", "pres"),
  73. max_homepage_items = 12,
  74. },
  75. -- Content model doc generation settings.
  76. cmdoc_gen = {
  77. out_dir = plpath.join(ROOT, "out", "cmdoc"),
  78. },
  79. }