Add cron container for daily backups and content export
- Add cron service to docker-compose with backup (3 AM) and export (4 AM) schedules - Remove redundant content/articles/ and content/curriculum/ (now in Outline, exported to content/wiki/) - Fix env var mismatch: support both OUTLINE_API_KEY and OUTLINE_API_TOKEN - Drop updatedAt from export frontmatter to reduce noisy commits - Add backups/ to gitignore
This commit is contained in:
parent
f5a69b8683
commit
8e7424ed05
49 changed files with 84 additions and 7530 deletions
|
|
@ -7,18 +7,23 @@ set -euo pipefail
|
|||
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
# Source env vars (line-by-line to handle unquoted values with spaces)
|
||||
while IFS='=' read -r key value; do
|
||||
[[ -z "$key" || "$key" =~ ^# ]] && continue
|
||||
export "$key=$value"
|
||||
done < outline.env
|
||||
# Source env vars from outline.env if it exists (for host-based cron),
|
||||
# otherwise rely on env vars from docker-compose env_file
|
||||
if [[ -f outline.env ]]; then
|
||||
while IFS='=' read -r key value; do
|
||||
[[ -z "$key" || "$key" =~ ^# ]] && continue
|
||||
export "$key=$value"
|
||||
done < outline.env
|
||||
fi
|
||||
|
||||
# Map Outline's URL to OUTLINE_URL if not already set
|
||||
export OUTLINE_URL="${OUTLINE_URL:-$URL}"
|
||||
export OUTLINE_URL="${OUTLINE_URL:-${URL:-}}"
|
||||
|
||||
# Support both OUTLINE_API_KEY (outline.env) and OUTLINE_API_TOKEN (scripts)
|
||||
export OUTLINE_API_TOKEN="${OUTLINE_API_TOKEN:-${OUTLINE_API_KEY:-}}"
|
||||
|
||||
# OUTLINE_API_TOKEN must be set in the environment or in outline.env
|
||||
if [[ -z "${OUTLINE_API_TOKEN:-}" ]]; then
|
||||
echo "Error: OUTLINE_API_TOKEN is not set" >&2
|
||||
echo "Error: OUTLINE_API_TOKEN or OUTLINE_API_KEY must be set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@ async function main() {
|
|||
path: docPath,
|
||||
parentDocument: parentTitle,
|
||||
outlineId: doc.id,
|
||||
updatedAt: doc.updatedAt,
|
||||
createdBy: doc.createdBy?.email || doc.createdBy?.name || null,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue