mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 13:26:07 +00:00
Share Fastly and Netlify redirects (#5619)
* consolidate netlify and fastly redirects * remove validation check to support full url redirects
This commit is contained in:
parent
5e8b20e344
commit
0015326cea
@ -7,7 +7,7 @@ activate :hashicorp do |h|
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Netlify redirects/headers
|
# Netlify redirects/headers
|
||||||
proxy '_redirects', 'netlify-redirects', ignore: true
|
proxy '_redirects', 'redirects.txt', ignore: true
|
||||||
|
|
||||||
helpers do
|
helpers do
|
||||||
# Returns a segment tracking ID such that local development is not
|
# Returns a segment tracking ID such that local development is not
|
||||||
|
@ -5,6 +5,7 @@ PROJECT="consul"
|
|||||||
PROJECT_URL="www.consul.io"
|
PROJECT_URL="www.consul.io"
|
||||||
FASTLY_SERVICE_ID="7GrxRJP3PVBuqQbyxYQ0MV"
|
FASTLY_SERVICE_ID="7GrxRJP3PVBuqQbyxYQ0MV"
|
||||||
FASTLY_DICTIONARY_ID="7d0yAgSHAQ2efWKeUC3kqW"
|
FASTLY_DICTIONARY_ID="7d0yAgSHAQ2efWKeUC3kqW"
|
||||||
|
REDIRECTS_FILE="./source/redirects.txt"
|
||||||
|
|
||||||
# Ensure the proper AWS environment variables are set
|
# Ensure the proper AWS environment variables are set
|
||||||
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
|
if [ -z "$AWS_ACCESS_KEY_ID" ]; then
|
||||||
@ -95,7 +96,8 @@ if [ -z "$NO_UPLOAD" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Add redirects if they exist
|
# Add redirects if they exist
|
||||||
if [ -z "$NO_REDIRECTS" ] || [ ! test -f "./redirects.txt" ]; then
|
# The redirects file is in the source/ directory
|
||||||
|
if [ -z "$NO_REDIRECTS" ] || [ ! test -f $REDIRECTS_FILE ]; then
|
||||||
echo "Adding redirects..."
|
echo "Adding redirects..."
|
||||||
fields=()
|
fields=()
|
||||||
while read -r line; do
|
while read -r line; do
|
||||||
@ -105,7 +107,7 @@ if [ -z "$NO_REDIRECTS" ] || [ ! test -f "./redirects.txt" ]; then
|
|||||||
# Read fields
|
# Read fields
|
||||||
IFS=" " read -ra parts <<<"$line"
|
IFS=" " read -ra parts <<<"$line"
|
||||||
fields+=("${parts[@]}")
|
fields+=("${parts[@]}")
|
||||||
done < "./redirects.txt"
|
done < REDIRECTS_FILE
|
||||||
|
|
||||||
# Check we have pairs
|
# Check we have pairs
|
||||||
if [ $((${#fields[@]} % 2)) -ne 0 ]; then
|
if [ $((${#fields[@]} % 2)) -ne 0 ]; then
|
||||||
@ -126,11 +128,6 @@ if [ -z "$NO_REDIRECTS" ] || [ ! test -f "./redirects.txt" ]; then
|
|||||||
echo "'$field' is > 256 characters!"
|
echo "'$field' is > 256 characters!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${field:0:1}" != "/" ]; then
|
|
||||||
echo "'$field' does not start with /!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Build the payload for single-request updates.
|
# Build the payload for single-request updates.
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
# Consul Redirects
|
# Consul Redirects
|
||||||
/api.html /api/index.html
|
/api.html https://www.consul.io/api/index.html
|
||||||
/api/acl.html /api/acl/acl.html
|
/api/acl.html https://www.consul.io/api/acl/acl.html
|
||||||
/docs/agent/acl-rules.html /docs/acl/acl-rules.html
|
/docs/agent/acl-rules.html https://www.consul.io/docs/acl/acl-rules.html
|
||||||
/docs/agent/acl-system.html /docs/acl/acl-system.html
|
/docs/agent/acl-system.html https://www.consul.io/docs/acl/acl-system.html
|
||||||
/docs/agent/http.html /api/index.html
|
/docs/agent/http.html https://www.consul.io/api/index.html
|
||||||
/docs/guides/acl-legacy.html /docs/acl/acl-legacy.html
|
/docs/guides/acl-legacy.html https://www.consul.io/docs/acl/acl-legacy.html
|
||||||
/docs/guides/acl-migrate-acl-tokens.html /docs/acl/acl-migrate-acl-tokens.html
|
/docs/guides/acl-migrate-acl-tokens.html https://www.consul.io/docs/acl/acl-migrate-acl-tokens.html
|
||||||
/docs/guides/bootstrapping.html /docs/install/bootstrapping.html
|
/docs/guides/bootstrapping.html https://www.consul.io/docs/install/bootstrapping.html
|
||||||
/docs/guides/sentinel.html /docs/agent/sentinel.html
|
/docs/guides/sentinel.html https://www.consul.io/docs/agent/sentinel.html
|
||||||
|
|
||||||
# Consul Learn Redirects
|
# Consul Learn Redirects
|
||||||
/docs/guides/acl.html https://learn.hashicorp.com/consul/advanced/day-1-operations/acl-guide
|
/docs/guides/acl.html https://learn.hashicorp.com/consul/advanced/day-1-operations/acl-guide
|
Loading…
x
Reference in New Issue
Block a user