Skip to content

Commit

Permalink
Bind uvicorn to 0.0.0.0 to allow containerized dev server use
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed May 12, 2023
1 parent 225ea4b commit 3ef933b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash

THIS_FILE=`basename "$0"`

if [ -z "$OPTIMADE_CONFIG_FILE" ]; then
export OPTIMADE_CONFIG_FILE="./optimade_config.json"
echo "Using the demo config file at ${OPTIMADE_CONFIG_FILE}."
echo "Set the environment variable OPTIMADE_CONFIG_FILE to override this behaviour."
echo "For more configuration options, please see https://www.optimade.org/optimade-python-tools/configuration/."
echo -e "INFO:\t[${THIS_FILE}] Using the demo config file at ${OPTIMADE_CONFIG_FILE}."
echo -e "INFO:\t[${THIS_FILE}] Set the environment variable OPTIMADE_CONFIG_FILE to override this behaviour."
echo -e "INFO:\t[${THIS_FILE}] For more configuration options, please see https://www.optimade.org/optimade-python-tools/configuration/."
fi

export OPTIMADE_LOG_LEVEL=info
Expand All @@ -29,4 +31,6 @@ else
fi
fi

uvicorn optimade.server.$MAIN:app --reload --port $PORT --log-level $OPTIMADE_LOG_LEVEL
echo -e "INFO:\t[${THIS_FILE}] Launching the development server with uvicorn for the ${MAIN} app on port ${PORT} with log level ${OPTIMADE_LOG_LEVEL}."

uvicorn optimade.server.$MAIN:app --reload --port $PORT --log-level $OPTIMADE_LOG_LEVEL --host 0.0.0.0

0 comments on commit 3ef933b

Please sign in to comment.