diff --git a/config.example.toml b/config.example.toml new file mode 100644 index 0000000..2626b39 --- /dev/null +++ b/config.example.toml @@ -0,0 +1,154 @@ +# cf-temp-email 多账号配置样例 +# +# 用法示例: +# uv run cf-temp-email check --config config.样例.toml --profile account_a +# uv run cf-temp-email deploy --config config.样例.toml --profile account_a +# uv run cf-temp-email deploy --config config.样例.toml --profile account_b +# +# 说明: +# 1. 根配置可以作为所有 profile 的公共默认值。 +# 2. [profiles..*] 只写需要覆盖的字段即可。 +# 3. 每个 profile 会使用独立的状态文件: +# .deploy/profiles//state.toml +# 4. clone 模式下,如果没有单独指定 workspace_dir,程序会自动给每个 profile 使用独立 workspace。 + +# 主配置版本号,供 CLI 与状态加载逻辑识别。 +config_version = 1 + +[source] +# "clone": 自动拉取远端仓库并构建 +# "local": 使用本地源码目录 +mode = "clone" +repo_url = "https://github.com/dreamhunter2333/cloudflare_temp_email.git" +repo_ref = "" +workspace_dir = ".deploy/workspace" +local_path = "" + +[cloudflare] +# 根配置可以放公共默认值。 +# 如果你的不同账号差异很大,也可以只在各自 profile 中填写。 +account_id = "" +account_name = "" +zone_name = "example.com" +api_token = "" +api_token_env = "" +api_email = "" +api_email_env = "" +global_api_key = "" +global_api_key_env = "" + +[mail] +# 邮箱域名列表。支持多个域名,也支持二级域名。 +# 例如可同时支持: +# - @mail.example.com +# - @mail2.example.com +domains = ["mail.example.com"] +verified_destination_address = "inbox@example.net" + +[d1] +database_name = "cf-temp-email-db" +jurisdiction = "" +adopt_existing_schema = false + +[user_access] +require_login_to_create = true +allow_user_register = false + +[linuxdo] +# 不想用 Linux.do 时保持 false 即可。 +linuxdo_oauth = false +client_id = "" +client_secret = "" + +[worker] +script_name = "temp-email-api" +use_workers_dev = true +custom_domain = "email-api.example.com" +compatibility_date = "2024-09-23" + +[worker.vars] +PREFIX = "" +ENABLE_USER_CREATE_EMAIL = true +ENABLE_USER_DELETE_EMAIL = true +DEFAULT_LANG = "zh" +# 管理员密码,部署时会使用第一个值访问 /admin/* 接口。 +ADMIN_PASSWORDS = ["change-me"] + +[worker.secrets] +JWT_SECRET = "" + +[pages] +# Pages 前端域名,必须和 mail.domains 里的域名不同。 +# 例如: +# - mail.domains = ["mail.example.com"] +# - pages.custom_domain = "email.example.com" +project_name = "cf-temp-email-pages" +custom_domain = "email.example.com" +build_mode = "pages" +production_branch = "production" + +# ------------------------------ +# Profile 样例 1:账号 A +# Zone: example.com +# 邮箱域名: +# - @mail.example.com +# - @mail2.example.com +# ------------------------------ + +[profiles.account_a.cloudflare] +account_id = "acc-a" +api_token_env = "CF_API_TOKEN_A" +zone_name = "example.com" + +[profiles.account_a.mail] +domains = ["mail.example.com", "mail2.example.com"] +verified_destination_address = "inbox@example.net" + +[profiles.account_a.d1] +database_name = "cf-temp-email-a" + +[profiles.account_a.worker] +script_name = "temp-email-api-a" +custom_domain = "email-api.example.com" + +[profiles.account_a.worker.vars] +ADMIN_PASSWORDS = ["admin-password-a"] + +[profiles.account_a.pages] +project_name = "cf-temp-email-pages-a" +custom_domain = "email.example.com" + +# ------------------------------ +# Profile 样例 2:账号 B +# Zone: kotei.asia +# 邮箱域名: +# - @mail.kotei.asia +# - @maila.kotei.asia +# Pages 前端域名: +# - email.kotei.asia +# Worker 健康检查域名: +# - email-api.kotei.asia +# ------------------------------ + +[profiles.account_b.cloudflare] +account_id = "acc-b" +api_token_env = "CF_API_TOKEN_B" +zone_name = "kotei.asia" + +[profiles.account_b.mail] +domains = ["mail.kotei.asia", "maila.kotei.asia"] +verified_destination_address = "inbox@example.net" + +[profiles.account_b.d1] +database_name = "cf-temp-email-b" + +[profiles.account_b.worker] +script_name = "temp-email-api-b" +custom_domain = "email-api.kotei.asia" + +[profiles.account_b.worker.vars] +ADMIN_PASSWORDS = ["admin-password-b"] + +[profiles.account_b.pages] +project_name = "cf-temp-email-pages-b" +custom_domain = "email.kotei.asia"