File tree 2 files changed +11
-2
lines changed
2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 34
34
expires 1d ;
35
35
36
36
location ~* \.(?:json|yml|yaml)$ {
37
+ #SWAGGER_ROOT
37
38
expires -1;
38
39
39
40
include cors.conf;
Original file line number Diff line number Diff line change 4
4
BASE_URL=${BASE_URL:-/ }
5
5
NGINX_ROOT=/usr/share/nginx/html
6
6
INDEX_FILE=$NGINX_ROOT /index.html
7
+ NGINX_CONF=/etc/nginx/nginx.conf
7
8
8
9
node /usr/share/nginx/configurator $INDEX_FILE
9
10
@@ -24,7 +25,7 @@ replace_or_delete_in_index () {
24
25
}
25
26
26
27
if [ " ${BASE_URL} " ]; then
27
- sed -i " s|location / {|location $BASE_URL {|g" /etc/nginx/nginx.conf
28
+ sed -i " s|location / {|location $BASE_URL {|g" $NGINX_CONF
28
29
fi
29
30
30
31
replace_in_index myApiKeyXXXX123456789 $API_KEY
37
38
if [[ -f " $SWAGGER_JSON " ]]; then
38
39
cp -s " $SWAGGER_JSON " " $NGINX_ROOT "
39
40
REL_PATH=" ./$( basename $SWAGGER_JSON ) "
41
+
42
+ if [[ -z " $SWAGGER_ROOT " ]]; then
43
+ SWAGGER_ROOT=" $( dirname $SWAGGER_JSON ) "
44
+ fi
45
+
46
+ sed -i " s|#SWAGGER_ROOT|root $SWAGGER_ROOT ;|g" $NGINX_CONF
Has a conversation. Original line has a conversation.
47
+
40
48
sed -i " s|https://petstore.swagger.io/v2/swagger.json|$REL_PATH |g" $INDEX_FILE
41
49
sed -i " s|http://example.com/api|$REL_PATH |g" $INDEX_FILE
42
50
fi
43
51
44
52
# replace the PORT that nginx listens on if PORT is supplied
45
53
if [[ -n " ${PORT} " ]]; then
46
- sed -i " s|8080|${PORT} |g" /etc/nginx/nginx.conf
54
+ sed -i " s|8080|${PORT} |g" $NGINX_CONF
47
55
fi
48
56
49
57
find $NGINX_ROOT -type f -regex " .*\.\(html\|js\|css\)" -exec sh -c " gzip < {} > {}.gz" \;
You can’t perform that action at this time.