Merge pull request #62 from Jah-yee/fix/issue-31-port-and-state-hints

fix: add startup hints for port and state source (fixes #31)
This commit is contained in:
ringhyacinth 2026-03-06 14:11:32 +08:00 committed by GitHub
commit a139bb05b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -2058,6 +2058,10 @@ if __name__ == "__main__":
print("=" * 50)
print(f"State file: {STATE_FILE}")
print(f"Listening on: http://0.0.0.0:{backend_port}")
if backend_port != 18791:
print(f"(Port override: set STAR_BACKEND_PORT to change; current: {raw_port})")
else:
print("(Set STAR_BACKEND_PORT to use a different port, e.g. 3009)")
mode = "production" if is_production_mode() else "development"
print(f"Mode: {mode}")
if is_production_mode():

View file

@ -262,6 +262,17 @@ def do_push(local, status_data):
def main():
local = load_local_state()
# Startup hint for state source and URL (helps with port/state issues, e.g. issue #31)
if LOCAL_STATE_FILE:
print(f"State file: {LOCAL_STATE_FILE}")
else:
first_existing = next((p for p in DEFAULT_STATE_CANDIDATES if p and os.path.exists(p)), None)
if first_existing:
print(f"State file (auto): {first_existing}")
else:
print("State file: auto-discover (set OFFICE_LOCAL_STATE_FILE if state not found)")
print(f"Local status URL: {LOCAL_STATUS_URL} (set OFFICE_LOCAL_STATUS_URL if backend uses another port)")
# 先确认配置是否齐全
if not JOIN_KEY or not AGENT_NAME:
print("❌ 请先在脚本开头填入 JOIN_KEY 和 AGENT_NAME")