forked from clue/docker-json-server
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·36 lines (31 loc) · 763 Bytes
/
run.sh
File metadata and controls
executable file
·36 lines (31 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
file=/data-server/server.js
if [ -f $file ]; then
echo "Found server.js, ignoring other files"
args="$@"
node $file $args
else
if [ -z "$HOST" ]; then
HOST="0.0.0.0"
fi
if [ -z "$PORT" ]; then
PORT="80"
fi
file=/data/db.json
if [ -f $file ]; then
echo "Found db.json, trying to open"
args="$args -w db.json"
fi
file=/data/routes.json
if [ -f $file ]; then
echo "Found routes.js file, trying to open"
args="$args -r routes.json"
fi
file=/data/file.js
if [ -f $file ]; then
echo "Found file.js seed file, trying to open"
args="$args file.js"
fi
args="$@ $args -H '$HOST' -p '$PORT'"
json-server $args
fi