From a23a777005fb5d9623b1f9ef0b0b682b247e9255 Mon Sep 17 00:00:00 2001 From: mahtin Date: Tue, 17 May 2016 04:29:13 -0700 Subject: [PATCH] Make pagerule example more readable --- examples/example-page-rules.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/example-page-rules.sh b/examples/example-page-rules.sh index 8d1d0ba..97d7c59 100755 --- a/examples/example-page-rules.sh +++ b/examples/example-page-rules.sh @@ -1,11 +1,16 @@ : -cli4 -v --post \ - targets='[ { "target": "url", "constraint": { "operator": "matches", "value": "*.example.com/url1*" } } ]' \ - actions='[ { "id": "forwarding_url", "value": { "status_code": 302, "url": "http://example.com/url2" } } ]' \ +ZONE=${1-example.com} + +URL_MATCH="*.${ZONE}/url1*" +URL_FORWARDED="http://${ZONE}/url2" + +cli4 --post \ + targets='[ { "target": "url", "constraint": { "operator": "matches", "value": "'${URL_MATCH}'" } } ]' \ + actions='[ { "id": "forwarding_url", "value": { "status_code": 302, "url": "'${URL_FORWARDED}'" } } ]' \ status=active \ priority=1 \ - /zones/:exmaple.com/pagerules | jq '{"status":.status,"priority":.priority,"id":.id}' + /zones/:${ZONE}/pagerules | jq '{"status":.status,"priority":.priority,"id":.id}' exit 0