feat: host publicly

This commit is contained in:
Evan Carroll 2026-01-20 16:10:41 -06:00
parent 29f29358fd
commit 3e1afb82c8

View file

@ -35,6 +35,7 @@ Options:
-k, --kill Kill existing instance and exit
-s, --status Check if an instance is running
-r, --release Build and run in release mode
--public Bind to 0.0.0.0 instead of 127.0.0.1
Examples:
$0 # Build and run both
@ -70,17 +71,19 @@ print_server_info() {
local mode="$1"
local build_type="Debug"
[ "$RELEASE" = "true" ] && build_type="Release"
local bind_addr="127.0.0.1"
[ "$PUBLIC" = "true" ] && bind_addr="0.0.0.0"
echo ""
echo "========================================"
echo " Chattyness Development ($mode - $build_type)"
echo "========================================"
echo ""
if run_owner; then
echo " Owner Admin: http://127.0.0.1:$OWNER_PORT"
echo " Owner Admin: http://$bind_addr:$OWNER_PORT"
fi
if run_app; then
echo " User App: http://127.0.0.1:$APP_PORT"
echo " Realm Admin: http://127.0.0.1:$APP_PORT/admin"
echo " User App: http://$bind_addr:$APP_PORT"
echo " Realm Admin: http://$bind_addr:$APP_PORT/admin"
fi
echo ""
if [ "$TARGET" = "both" ]; then
@ -225,6 +228,9 @@ do_watch() {
local release_flag=""
[ "$RELEASE" = "true" ] && release_flag="--release"
local bind_addr="127.0.0.1"
[ "$PUBLIC" = "true" ] && bind_addr="0.0.0.0"
# Build owner first to create CSS (needed if user app needs admin CSS)
if run_owner; then
echo "Building owner app first (for admin CSS)..."
@ -234,12 +240,12 @@ do_watch() {
# Start watch processes
if run_owner; then
cargo leptos watch -p chattyness-owner $release_flag &
HOST="$bind_addr" cargo leptos watch -p chattyness-owner $release_flag &
OWNER_PID=$!
fi
if run_app; then
cargo leptos watch -p chattyness-app --split $release_flag &
HOST="$bind_addr" cargo leptos watch -p chattyness-app --split $release_flag &
APP_PID=$!
fi
@ -279,15 +285,18 @@ do_build() {
fi
# Start servers
local bind_addr="127.0.0.1"
[ "$PUBLIC" = "true" ] && bind_addr="0.0.0.0"
if run_owner; then
echo "Starting Owner Server on :$OWNER_PORT..."
./target/$target_dir/chattyness-owner &
echo "Starting Owner Server on $bind_addr:$OWNER_PORT..."
HOST="$bind_addr" ./target/$target_dir/chattyness-owner &
OWNER_PID=$!
fi
if run_app; then
echo "Starting App Server on :$APP_PORT..."
./target/$target_dir/chattyness-app &
echo "Starting App Server on $bind_addr:$APP_PORT..."
HOST="$bind_addr" ./target/$target_dir/chattyness-app &
APP_PID=$!
fi
@ -306,6 +315,7 @@ FORCE="false"
KILL_EXISTING="false"
CHECK_STATUS="false"
RELEASE="false"
PUBLIC="false"
for arg in "$@"; do
case $arg in
@ -333,6 +343,9 @@ for arg in "$@"; do
-r | --release)
RELEASE="true"
;;
--public)
PUBLIC="true"
;;
--help | -h)
usage
;;