Last active
April 11, 2016 17:16
-
-
Save hophacker/d3642d067d56e5edbc9bd6792a77c96a to your computer and use it in GitHub Desktop.
command for starting rails server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash - | |
set -o nounset # Treat unset variables as an error | |
port=3002 | |
search=false | |
RAILS_ENV=${RAILS_ENV:-development} | |
while getopts p:e:rw:s opt | |
do | |
case "$opt" in | |
p) | |
port=$OPTARG | |
;; | |
s) | |
search=true | |
;; | |
[?]) echo -e >&2 "Usage: \n\t-e [environment: default development | production] \n\t-p [port: default 80]" | |
exit 1 | |
;; | |
esac | |
done | |
if [ $search = true ]; then | |
bundle exec rake sunspot:solr:start | |
bundle exec rake sunspot:solr:reindex | |
fi | |
export ROOT_URL=${ROOT_URL:-http://trainwith.cn/} | |
if [ $RAILS_ENV = "development" ]; then | |
export BAIDU_MAP_API_KEY="v9cvM6PLGPhfoeQA35b5dsVu" | |
elif [ $RAILS_ENV = "production" ]; then | |
export BAIDU_MAP_API_KEY="eD9GHzQcS2Zl1QPtGRDikPW5" | |
fi | |
export QINIU_DOMAIN="http://7xpmg1.com1.z0.glb.clouddn.com" | |
export SECRET_KEY_BASE=$(openssl rand -hex 64) | |
rails s -b 0.0.0.0 -p $port |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment