dan92 commited on
Commit
d3e8349
·
verified ·
1 Parent(s): 40e515b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -12
app.py CHANGED
@@ -48,19 +48,11 @@ CORS(app, resources={r"/*": {"origins": "*"}})
48
  executor = ThreadPoolExecutor(max_workers=10)
49
 
50
  proxy_url = os.getenv('PROXY_URL')
 
51
  NOTDIAMOND_DOMAIN = os.getenv('NOTDIAMOND_DOMAIN')
52
 
53
- # 尝试自动获取域名的 IP 地址
54
- try:
55
- NOTDIAMOND_IP = socket.gethostbyname(NOTDIAMOND_DOMAIN)
56
- logger.info(f"Automatically resolved {NOTDIAMOND_DOMAIN} to IP: {NOTDIAMOND_IP}")
57
- except socket.gaierror:
58
- # 如果解析失败,回退到默认值
59
- NOTDIAMOND_IP = os.getenv('NOTDIAMOND_IP')
60
- logger.warning(f"Failed to resolve {NOTDIAMOND_DOMAIN}, using default IP: {NOTDIAMOND_IP}")
61
-
62
  if not NOTDIAMOND_IP:
63
- logger.error("NOTDIAMOND_IP could not be determined!")
64
  raise ValueError("NOTDIAMOND_IP must be set")
65
 
66
  # API密钥验证装饰器
@@ -790,5 +782,4 @@ if __name__ == "__main__":
790
  health_check_thread.start()
791
 
792
  port = int(os.environ.get("PORT", 3000))
793
- app.run(debug=False, host='0.0.0.0', port=port, threaded=True)
794
-
 
48
  executor = ThreadPoolExecutor(max_workers=10)
49
 
50
  proxy_url = os.getenv('PROXY_URL')
51
+ NOTDIAMOND_IP = os.getenv('NOTDIAMOND_IP')
52
  NOTDIAMOND_DOMAIN = os.getenv('NOTDIAMOND_DOMAIN')
53
 
 
 
 
 
 
 
 
 
 
54
  if not NOTDIAMOND_IP:
55
+ logger.error("NOTDIAMOND_IP environment variable is not set!")
56
  raise ValueError("NOTDIAMOND_IP must be set")
57
 
58
  # API密钥验证装饰器
 
782
  health_check_thread.start()
783
 
784
  port = int(os.environ.get("PORT", 3000))
785
+ app.run(debug=False, host='0.0.0.0', port=port, threaded=True)