Skip to content

Commit 54653a8

Browse files
zc-devsdekobon
andcommitted
Add cache variables to stand-alone install script
Co-authored-by: Elijah Zupancic <[email protected]>
1 parent 8b57860 commit 54653a8

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

standalone_ubuntu_oss_install.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ fi
127127

128128

129129
if [ "${to_install}" != "" ]; then
130+
echo "▶ Installing ${to_install}"
130131
apt-get -qq install --yes ${to_install}
131132
echo "▶ Stopping nginx so that it can be configured as a S3 Gateway"
132133
systemctl stop nginx
@@ -135,7 +136,7 @@ fi
135136
echo "▶ Adding environment variables to NGINX configuration file: /etc/nginx/environment"
136137
cat > "/etc/nginx/environment" << EOF
137138
# Enables or disables directory listing for the S3 Gateway (true=enabled, false=disabled)
138-
ALLOW_DIRECTORY_LIST=${ALLOW_DIRECTORY_LIST}
139+
ALLOW_DIRECTORY_LIST=${ALLOW_DIRECTORY_LIST:-'false'}
139140
# Enables or disables directory listing for the S3 Gateway (true=enabled, false=disabled)
140141
DIRECTORY_LISTING_PATH_PREFIX=${DIRECTORY_LISTING_PATH_PREFIX:-''}
141142
# AWS Authentication signature version (2=v2 authentication, 4=v4 authentication)
@@ -151,26 +152,27 @@ S3_SERVER_PROTO=${S3_SERVER_PROTO}
151152
# S3 host to connect to
152153
S3_SERVER=${S3_SERVER}
153154
# The S3 host/path method - 'virtual', 'path' or 'default'
154-
S3_STYLE=${S3_STYLE}
155+
S3_STYLE=${S3_STYLE:-'default'}
155156
# Flag (true/false) enabling AWS signatures debug output (default: false)
156-
DEBUG=${DEBUG}
157+
DEBUG=${DEBUG:-'false'}
157158
# Cache size limit
158-
PROXY_CACHE_MAX_SIZE=${PROXY_CACHE_MAX_SIZE}
159+
PROXY_CACHE_MAX_SIZE=${PROXY_CACHE_MAX_SIZE:-'10g'}
159160
# Cached data that are not accessed during the time get removed
160-
PROXY_CACHE_INACTIVE=${PROXY_CACHE_INACTIVE}
161+
PROXY_CACHE_INACTIVE=${PROXY_CACHE_INACTIVE:-'60m'}
161162
# Proxy caching time for response code 200 and 302
162-
PROXY_CACHE_VALID_OK=${PROXY_CACHE_VALID_OK}
163+
PROXY_CACHE_VALID_OK=${PROXY_CACHE_VALID_OK:-'1h'}
163164
# Proxy caching time for response code 404
164-
PROXY_CACHE_VALID_NOTFOUND=${PROXY_CACHE_VALID_NOTFOUND}
165+
PROXY_CACHE_VALID_NOTFOUND=${PROXY_CACHE_VALID_NOTFOUND:-'1m'}
165166
# Proxy caching time for response code 403
166-
PROXY_CACHE_VALID_FORBIDDEN=${PROXY_CACHE_VALID_FORBIDDEN}
167+
PROXY_CACHE_VALID_FORBIDDEN=${PROXY_CACHE_VALID_FORBIDDEN:-'30s'}
167168
# Enables or disables CORS for the S3 Gateway (true=enabled, false=disabled)
168-
CORS_ENABLED=${CORS_ENABLED}
169+
CORS_ENABLED=${CORS_ENABLED:-'false'}
169170
EOF
170171

171172
# By enabling CORS, we also need to enable the OPTIONS method which
172173
# is not normally used as part of the gateway. The following variable
173174
# defines the set of acceptable headers.
175+
set +o nounset # don't abort on unbound variable
174176
if [ "${CORS_ENABLED}" == "1" ]; then
175177
cat >> "/etc/nginx/environment" << EOF
176178
LIMIT_METHODS_TO="GET HEAD OPTIONS"
@@ -182,6 +184,7 @@ LIMIT_METHODS_TO="GET HEAD"
182184
LIMIT_METHODS_TO_CSV="GET, HEAD"
183185
EOF
184186
fi
187+
set -o nounset # abort on unbound variable
185188

186189
if [ -z "${CORS_ALLOWED_ORIGIN+x}" ]; then
187190
CORS_ALLOWED_ORIGIN="*"

0 commit comments

Comments
 (0)