Skip to content

Commit

Permalink
Merge pull request #85 from Coding/summer/config-file
Browse files Browse the repository at this point in the history
Add config file to let users modify config easily.
  • Loading branch information
tanhe123 authored Nov 28, 2016
2 parents 833129f + f34eedd commit 7ac1967
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 7 deletions.
18 changes: 18 additions & 0 deletions config
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Environment for running the application, either "prod" or "dev"
#RUN_ENV=

# USER INFO
#USERNAME=
#EMAIL=
#AVATAR=

# CORS (Seprate with comma)
#ALLOWED_ORIGINS=

# Home Directory(Do not modify when using docker)
#CODING_IDE_HOME=
#SPACE_HOME=

# Max file size to upload (in Mb)
#UPLOAD_FILE_SIZE_LIMIT=

32 changes: 25 additions & 7 deletions ide.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,37 @@ do_build_frontend() {
cd $BASEDIR
}

do_build_backend() {
cd $BACKEND
echo "mvn clean and packaging..."
mvn clean package -Dmaven.test.skip=true
valid_last_cmd
cd $BASEDIR
}

sub_build() {

build_usage() {
echo "Usage: $PROG_NAME build frontend"
echo "Usage: $PROG_NAME build [frontend | backend | run]"
}

case $1 in
"-h" | "--help")
build_usage
;;
"" | "frontend")
"")
do_build_frontend
do_build_backend
;;
"backend")
do_build_backend
;;
"frontend")
do_build_frontend
;;
"run") # build and run
do_build_frontend
do_build_backend
do_run_backend
;;
esac
Expand Down Expand Up @@ -193,7 +209,7 @@ sub_docker() {
create_dir_if_not_exist $HOME/.coding-ide-home

echo "creating container $CONTAINER"
docker create -p 8080:8080 -v $HOME/.coding-ide-home:/home/coding/coding-ide-home --name webide -h webide webide/webide
docker create -p 8080:8080 --env-file config -v $HOME/.coding-ide-home:/home/coding/coding-ide-home --name webide -h webide webide/webide
valid_last_cmd
elif [ "$RUNNING" == "true" ]; then
echo "CRITICAL - $CONTAINER is running."
Expand Down Expand Up @@ -234,9 +250,11 @@ sub_docker() {
}

do_run_backend() {
cd $BACKEND
mvn clean && mvn spring-boot:run ${1}
cd $BASEDIR
if [ ! -f $BACKEND/target/ide-backend.jar ]; then
sub_build
fi
. $BASEDIR/config
java -jar $BACKEND/target/ide-backend.jar --PTY_LIB_FOLDER=$BACKEND/src/main/resources/lib ${1}
}

sub_run() {
Expand All @@ -250,7 +268,7 @@ sub_run() {
while getopts ":p:" opt; do
case $opt in
p)
EXTRA_VARS=-Drun.arguments="--server.port=${OPTARG}"
EXTRA_VARS="--server.port=${OPTARG}"
;;
\?)
run_usage
Expand Down

0 comments on commit 7ac1967

Please sign in to comment.