config.sample.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. // Manage client configuration for the photography portfolio.
  3. //
  4. // Copy this file to config.php in the same folder and fill in the three
  5. // connection values. config.php holds the instance token: it is gitignored,
  6. // excluded from release packages, and never part of a backup.
  7. //
  8. // Every constant has a default in lib/client.php — the values below are the
  9. // ones this project needs to deviate on, plus the connection block.
  10. // Reference: client-package/docs/03_CONFIG_REFERENCE.md
  11. // ---------------------------------------------------------------------------
  12. // Connection
  13. // ---------------------------------------------------------------------------
  14. // Base URL of the manage server, no trailing slash, no /api.
  15. define('MANAGE_SERVER_URL', 'https://manage.med0.de');
  16. // Instance id and token from the manage server (Instances -> create instance).
  17. // The token is shown exactly once, right after the instance is created.
  18. define('MANAGE_INSTANCE', '');
  19. define('MANAGE_TOKEN', '');
  20. // Seconds per HTTP request. Gallery media makes backups large, so the long
  21. // timeout (upload, package download) is generous.
  22. define('MANAGE_HTTP_TIMEOUT', 15);
  23. define('MANAGE_HTTP_TIMEOUT_LONG', 600);
  24. // ---------------------------------------------------------------------------
  25. // Application layout
  26. // ---------------------------------------------------------------------------
  27. // manage-client/ sits in the document root, next to index.php.
  28. define('MANAGE_APP_ROOT', dirname(__DIR__));
  29. // The installed version lives in app/version.php as APP_VERSION. The file is
  30. // read with a regular expression, never executed, so the value stays readable
  31. // even in a process that already loaded the old constant.
  32. define('MANAGE_VERSION_FILE', MANAGE_APP_ROOT . '/app/version.php');
  33. define('MANAGE_VERSION_CONSTANT', 'APP_VERSION');
  34. // Working directories, all under data/ — which .htaccess already blocks and
  35. // .gitignore already excludes.
  36. define('MANAGE_WORK_DIR', MANAGE_APP_ROOT . '/data/manage/work/');
  37. define('MANAGE_UPDATE_BACKUP_DIR', MANAGE_APP_ROOT . '/data/manage/updates/');
  38. define('MANAGE_BACKUP_DIR', MANAGE_APP_ROOT . '/data/manage/backups/');
  39. define('MANAGE_LOG_FILE', MANAGE_APP_ROOT . '/data/manage/manage-client.log');
  40. // ---------------------------------------------------------------------------
  41. // Update
  42. // ---------------------------------------------------------------------------
  43. // Never overwritten by an update. config/ holds this installation's S3
  44. // credentials and the admin password hash; data/ and media/ are its content.
  45. // The sample files in config/ are deliberately not protected, so a release can
  46. // still ship new defaults for them.
  47. define('MANAGE_UPDATE_PROTECTED_PATHS', [
  48. 'config/config.php',
  49. 'config/credentials.php',
  50. 'data/',
  51. 'media/',
  52. '.git/',
  53. 'manage-client/config.php',
  54. ]);
  55. // A package must contain these, otherwise it is not this application and
  56. // nothing is copied.
  57. define('MANAGE_UPDATE_SANITY_PATHS', ['app/bootstrap.php']);
  58. // Runs after a successful deployment: creates missing directories, clears the
  59. // archive worker's stale lock, appends to data/update-history.log.
  60. define('MANAGE_UPDATE_POST_HOOK', [
  61. 'file' => MANAGE_APP_ROOT . '/app/after-update.php',
  62. 'callback' => 'after_update_hook',
  63. ]);
  64. // Migrations shipped inside the release package (see migrations/README.md).
  65. // Not to be confused with the per-gallery data migration in admin/migrate.php,
  66. // which stays an operator decision.
  67. define('MANAGE_MIGRATIONS_DIR', MANAGE_APP_ROOT . '/migrations');
  68. define('MANAGE_MIGRATIONS_STATE', MANAGE_APP_ROOT . '/data/manage/migrations.json');
  69. // ---------------------------------------------------------------------------
  70. // Backup
  71. // ---------------------------------------------------------------------------
  72. // Operational data only: the flat-file storage plus the locally hosted images.
  73. // Gallery photos live in S3 and are not part of this — the bucket is the
  74. // system of record for those. Application files come from the release package.
  75. //
  76. // config/credentials.php and config/config.php stay out on purpose: a backup
  77. // is uploaded to the manage server and can be downloaded there, so it must not
  78. // carry the S3 keys or the admin password hash.
  79. define('MANAGE_BACKUP_SOURCES', [
  80. // site.json, archive-queue.json, worker-key.json, login-throttle.json
  81. ['as' => 'data', 'glob' => 'data/*.json'],
  82. // One JSON file per gallery: titles, topics, image lists, passwords.
  83. ['as' => 'data/galleries', 'dir' => 'data/galleries'],
  84. // Hero image and showreel images, uploaded through the backoffice.
  85. ['as' => 'media', 'dir' => 'media'],
  86. // Which release migrations have run — lives under data/manage/, which is
  87. // otherwise excluded so the backup directory cannot back itself up.
  88. ['as' => 'manage', 'file' => 'data/manage/migrations.json'],
  89. ]);
  90. // No database: this project is flat-file throughout.
  91. define('MANAGE_BACKUP_DATABASE', null);
  92. // Local archives kept on the instance. They contain JPEGs, so they are large;
  93. // the manage server keeps the longer history.
  94. define('MANAGE_BACKUP_LOCAL_RETENTION', 3);
  95. // Interval for manageBackupCreateAutomaticIfDue(), called from the admin
  96. // dashboard. 0 disables it — the right value when cron runs the CLI instead.
  97. // On hosting without cron, set 604800 (weekly) and let the dashboard do it.
  98. define('MANAGE_BACKUP_AUTO_INTERVAL_SECONDS', 0);
  99. // JPEGs do not compress; the JSON files do, and they are the small part.
  100. // Leaving deflate on costs little and keeps the JSON side small.
  101. define('MANAGE_BACKUP_COMPRESS', true);
  102. // Upload every new backup to the manage server.
  103. define('MANAGE_BACKUP_UPLOAD', true);
  104. // Additional targets besides the manage server: s3, sftp, custom.
  105. // See client-package/docs/05_BACKUP_SOURCES.md.
  106. define('MANAGE_BACKUP_REMOTE_TARGETS', []);