feat: add --api-host to bincio dev and --mobile to dev_test.py for local mobile testing
This commit is contained in:
+9
-6
@@ -11,6 +11,7 @@ Run from the project root:
|
||||
Options:
|
||||
--fresh Wipe DATA_DIR before starting (default: reuse if it exists)
|
||||
--no-dev Stop after extract (skip `bincio dev`)
|
||||
--mobile Bind API to 0.0.0.0 for mobile app testing on the same WiFi
|
||||
|
||||
Credentials: dave / testpass and brut / testpass
|
||||
URL: http://localhost:4321
|
||||
@@ -139,7 +140,7 @@ def prepare_serve() -> None:
|
||||
|
||||
# ── 4. Hand off to bincio dev ─────────────────────────────────────────────────
|
||||
|
||||
def start_dev() -> None:
|
||||
def start_dev(mobile: bool = False) -> None:
|
||||
section("Starting bincio dev")
|
||||
print()
|
||||
print(" \033[1mCredentials\033[0m")
|
||||
@@ -150,11 +151,12 @@ def start_dev() -> None:
|
||||
print()
|
||||
print(" Press Ctrl+C to stop.\n")
|
||||
|
||||
cmd = ["uv", "run", "bincio", "dev", "--data-dir", str(DATA_DIR)]
|
||||
if mobile:
|
||||
cmd += ["--api-host", "0.0.0.0"]
|
||||
|
||||
try:
|
||||
subprocess.run(
|
||||
["uv", "run", "bincio", "dev", "--data-dir", str(DATA_DIR)],
|
||||
cwd=PROJECT_DIR,
|
||||
)
|
||||
subprocess.run(cmd, cwd=PROJECT_DIR)
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
@@ -166,6 +168,7 @@ def main() -> None:
|
||||
formatter_class=argparse.RawDescriptionHelpFormatter)
|
||||
parser.add_argument("--fresh", action="store_true", help="Wipe DATA_DIR before starting")
|
||||
parser.add_argument("--no-dev", action="store_true", help="Stop after extract, skip bincio dev")
|
||||
parser.add_argument("--mobile", action="store_true", help="Bind API to 0.0.0.0 for local mobile testing")
|
||||
args = parser.parse_args()
|
||||
|
||||
print(f"\033[1mbincio dev test\033[0m → {DATA_DIR}")
|
||||
@@ -181,7 +184,7 @@ def main() -> None:
|
||||
prepare_serve()
|
||||
|
||||
if not args.no_dev:
|
||||
start_dev()
|
||||
start_dev(mobile=args.mobile)
|
||||
else:
|
||||
print(f"\n\033[32mDone.\033[0m Data ready at {DATA_DIR}")
|
||||
print(f"Run: uv run bincio dev --data-dir {DATA_DIR}\n")
|
||||
|
||||
Reference in New Issue
Block a user