-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.sh
34 lines (26 loc) · 1011 Bytes
/
entrypoint.sh
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
#!/bin/bash
OPTIONS_FILE="/options.conf"
if [ -f $OPTIONS_FILE ]; then
source $OPTIONS_FILE
fi
OPTIONS=$(cat <<EOF
{
singleView: ${singleView:-false},
disableThemeSwitcher: ${disableThemeSwitcher:-true},
disableRamlClientGenerator: ${disableRamlClientGenerator:-true},
resourcesCollapsed: ${resourcesCollapsed:-true},
documentationCollapsed: ${documentationCollapsed:-false},
allowUnsafeMarkdown: ${allowUnsafeMarkdown:-false},
disableTryIt: ${disableTryIt:-true}
}
EOF
)
OPTIONS=$(echo $OPTIONS | sed 's/ \{1,\}/ /g')
SEARCH_APP="<raml-initializer><\/raml-initializer>"
REPLACE_APP="<raml-console-loader src=\"raml\/$MAIN_RAML_PATH\" options=\"$OPTIONS\"><\/raml-console-loader>"
SEARCH_TITLE="<title>API Console</title>"
REPLACE_TITLE="<title>$PAGE_TITLE</title>"
sed -i "s/$SEARCH_APP/$REPLACE_APP/g" /app/index.html
sed -i "s|$SEARCH_TITLE|$REPLACE_TITLE|g" /app/index.html
sed -i 's|/usr/share/nginx/html|/app|g' /etc/nginx/conf.d/default.conf
exec /usr/sbin/nginx -g "daemon off;"