#!/bin/bash

PARAMS="$@"
if [[ $# = 1 ]] && [[ "$1" =~ "s" ]];
then
  PARAMS="$PARAMS -b 0.0.0.0"
fi
CMD="cd /src && HOME=/home/discourse RAILS_ENV=${RAILS_ENV:=development} chpst -u discourse:discourse rails $PARAMS"
docker exec -it discourse_dev /bin/bash -c "$CMD"
