| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- // Manage client configuration for the photography portfolio.
- //
- // Copy this file to config.php in the same folder and fill in the three
- // connection values. config.php holds the instance token: it is gitignored,
- // excluded from release packages, and never part of a backup.
- //
- // Every constant has a default in lib/client.php — the values below are the
- // ones this project needs to deviate on, plus the connection block.
- // Reference: client-package/docs/03_CONFIG_REFERENCE.md
- // ---------------------------------------------------------------------------
- // Connection
- // ---------------------------------------------------------------------------
- // Base URL of the manage server, no trailing slash, no /api.
- define('MANAGE_SERVER_URL', 'https://manage.med0.de');
- // Instance id and token from the manage server (Instances -> create instance).
- // The token is shown exactly once, right after the instance is created.
- define('MANAGE_INSTANCE', '');
- define('MANAGE_TOKEN', '');
- // Seconds per HTTP request. Gallery media makes backups large, so the long
- // timeout (upload, package download) is generous.
- define('MANAGE_HTTP_TIMEOUT', 15);
- define('MANAGE_HTTP_TIMEOUT_LONG', 600);
- // ---------------------------------------------------------------------------
- // Application layout
- // ---------------------------------------------------------------------------
- // manage-client/ sits in the document root, next to index.php.
- define('MANAGE_APP_ROOT', dirname(__DIR__));
- // The installed version lives in app/version.php as APP_VERSION. The file is
- // read with a regular expression, never executed, so the value stays readable
- // even in a process that already loaded the old constant.
- define('MANAGE_VERSION_FILE', MANAGE_APP_ROOT . '/app/version.php');
- define('MANAGE_VERSION_CONSTANT', 'APP_VERSION');
- // Working directories, all under data/ — which .htaccess already blocks and
- // .gitignore already excludes.
- define('MANAGE_WORK_DIR', MANAGE_APP_ROOT . '/data/manage/work/');
- define('MANAGE_UPDATE_BACKUP_DIR', MANAGE_APP_ROOT . '/data/manage/updates/');
- define('MANAGE_BACKUP_DIR', MANAGE_APP_ROOT . '/data/manage/backups/');
- define('MANAGE_LOG_FILE', MANAGE_APP_ROOT . '/data/manage/manage-client.log');
- // ---------------------------------------------------------------------------
- // Update
- // ---------------------------------------------------------------------------
- // Never overwritten by an update. config/ holds this installation's S3
- // credentials and the admin password hash; data/ and media/ are its content.
- // The sample files in config/ are deliberately not protected, so a release can
- // still ship new defaults for them.
- define('MANAGE_UPDATE_PROTECTED_PATHS', [
- 'config/config.php',
- 'config/credentials.php',
- 'data/',
- 'media/',
- '.git/',
- 'manage-client/config.php',
- ]);
- // A package must contain these, otherwise it is not this application and
- // nothing is copied.
- define('MANAGE_UPDATE_SANITY_PATHS', ['app/bootstrap.php']);
- // Runs after a successful deployment: creates missing directories, clears the
- // archive worker's stale lock, appends to data/update-history.log.
- define('MANAGE_UPDATE_POST_HOOK', [
- 'file' => MANAGE_APP_ROOT . '/app/after-update.php',
- 'callback' => 'after_update_hook',
- ]);
- // Migrations shipped inside the release package (see migrations/README.md).
- // Not to be confused with the per-gallery data migration in admin/migrate.php,
- // which stays an operator decision.
- define('MANAGE_MIGRATIONS_DIR', MANAGE_APP_ROOT . '/migrations');
- define('MANAGE_MIGRATIONS_STATE', MANAGE_APP_ROOT . '/data/manage/migrations.json');
- // ---------------------------------------------------------------------------
- // Backup
- // ---------------------------------------------------------------------------
- // Operational data only: the flat-file storage plus the locally hosted images.
- // Gallery photos live in S3 and are not part of this — the bucket is the
- // system of record for those. Application files come from the release package.
- //
- // config/credentials.php and config/config.php stay out on purpose: a backup
- // is uploaded to the manage server and can be downloaded there, so it must not
- // carry the S3 keys or the admin password hash.
- define('MANAGE_BACKUP_SOURCES', [
- // site.json, archive-queue.json, worker-key.json, login-throttle.json
- ['as' => 'data', 'glob' => 'data/*.json'],
- // One JSON file per gallery: titles, topics, image lists, passwords.
- ['as' => 'data/galleries', 'dir' => 'data/galleries'],
- // Hero image and showreel images, uploaded through the backoffice.
- ['as' => 'media', 'dir' => 'media'],
- // Which release migrations have run — lives under data/manage/, which is
- // otherwise excluded so the backup directory cannot back itself up.
- ['as' => 'manage', 'file' => 'data/manage/migrations.json'],
- ]);
- // No database: this project is flat-file throughout.
- define('MANAGE_BACKUP_DATABASE', null);
- // Local archives kept on the instance. They contain JPEGs, so they are large;
- // the manage server keeps the longer history.
- define('MANAGE_BACKUP_LOCAL_RETENTION', 3);
- // Interval for manageBackupCreateAutomaticIfDue(), called from the admin
- // dashboard. 0 disables it — the right value when cron runs the CLI instead.
- // On hosting without cron, set 604800 (weekly) and let the dashboard do it.
- define('MANAGE_BACKUP_AUTO_INTERVAL_SECONDS', 0);
- // JPEGs do not compress; the JSON files do, and they are the small part.
- // Leaving deflate on costs little and keeps the JSON side small.
- define('MANAGE_BACKUP_COMPRESS', true);
- // Upload every new backup to the manage server.
- define('MANAGE_BACKUP_UPLOAD', true);
- // Additional targets besides the manage server: s3, sftp, custom.
- // See client-package/docs/05_BACKUP_SOURCES.md.
- define('MANAGE_BACKUP_REMOTE_TARGETS', []);
|