feat: add email notification and logging features

- Introduce email notification configuration options in the README
- Create a new config.sh file for managing environment variables
- Implement mail.sh for sending email notifications
- Add logging functionality to main.sh for tracking synchronization processes

These changes enhance the functionality of the script by allowing users to receive email notifications about the synchronization status and maintain logs of the operations performed. The new configuration options provide flexibility in managing email settings and improve the overall usability of the tool.
This commit is contained in:
songtianlun
2025-01-03 17:03:01 +08:00
parent bf753e1255
commit 534a9ab0e4
5 changed files with 222 additions and 224 deletions

30
config.sh Normal file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
# GitHub 配置
GITHUB_USER=${GITHUB_USER:-"default-github-username"}
GITHUB_TOKEN=${GITHUB_TOKEN:-""}
# Gitea 配置
GITEA_URL=${GITEA_URL:-"https://your-gitea-instance"}
GITEA_USER=${GITEA_USER:-"default-gitea-username"}
GITEA_TOKEN=${GITEA_TOKEN:-"default-gitea-token"}
# 工作目录配置
WORK_DIR=${WORK_DIR:-"/tmp/github-mirror"}
LOG_DIR=${LOG_DIR:-"$WORK_DIR/logs"}
# 邮件配置
ENABLE_MAIL=${ENABLE_MAIL:-"false"}
SMTP_SERVER=${SMTP_SERVER:-""}
SMTP_PORT=${SMTP_PORT:-"587"}
SMTP_USER=${SMTP_USER:-""}
SMTP_PASS=${SMTP_PASS:-""}
MAIL_TO=${MAIL_TO:-""}
MAIL_FROM=${MAIL_FROM:-"$SMTP_USER"}
# 跳过的仓库
SKIP_REPOS=${SKIP_REPOS:-"archive,AutoApiSecret, \
backup-openbilibili-go-common, \
carrot,ChatGLM-6B,dokploy,hub-mirror, \
Download-macOS, \
songtianlun,songtianlun.github.io"}