-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
36 lines (28 loc) · 950 Bytes
/
config.py
File metadata and controls
36 lines (28 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# -*- coding: utf-8 -*-
"""
GitHub Hosts 自动更新服务配置文件
"""
import os
from pathlib import Path
# 项目根目录
PROJECT_ROOT = Path(__file__).parent
# Hosts文件配置
HOSTS_FILE_PATH = r"C:\Windows\System32\drivers\etc\hosts"
REMOTE_HOSTS_URL = "https://raw.hellogithub.com/hosts"
# GitHub520 hosts标记
GITHUB_START_MARKER = "# GitHub520 Host Start"
GITHUB_END_MARKER = "# Github520 Host End"
# 调度器配置
CHECK_INTERVAL_HOURS = 1 # 检查间隔(小时)
# 日志配置
LOG_DIR = PROJECT_ROOT / "logs"
LOG_FILE = LOG_DIR / "github_hosts_updater.log"
LOG_MAX_BYTES = 10 * 1024 * 1024 # 10MB
LOG_BACKUP_COUNT = 5
LOG_FORMAT = "%(asctime)s - %(levelname)s - %(message)s"
LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
# 网络请求配置
REQUEST_TIMEOUT = 30 # 请求超时时间(秒)
REQUEST_RETRY_COUNT = 3 # 重试次数
# 确保日志目录存在
LOG_DIR.mkdir(exist_ok=True)