X-Git-Url: https://git.openstreetmap.org/chef.git/blobdiff_plain/0eae31475f4a5696a1ab75ed601b3099110007e4..c5c96fb5c7e7f3a93a8dad7b6b5f178632bce19c:/cookbooks/tilecache/templates/default/nginx_generate_tilecache_qos_map.erb diff --git a/cookbooks/tilecache/templates/default/nginx_generate_tilecache_qos_map.erb b/cookbooks/tilecache/templates/default/nginx_generate_tilecache_qos_map.erb index a8f937823..279d67e98 100755 --- a/cookbooks/tilecache/templates/default/nginx_generate_tilecache_qos_map.erb +++ b/cookbooks/tilecache/templates/default/nginx_generate_tilecache_qos_map.erb @@ -1,14 +1,18 @@ #!/bin/bash # DO NOT EDIT - This file is being maintained by Chef - set -e + NUM_TOKENS=4 # current + 4 VALID_TOKEN=3600 # in seconds -QOS_TOKENS=($(/usr/bin/oathtool --totp --window=${NUM_TOKENS} --time-step-size=${VALID_TOKEN}s -b <%= @totp_key %>)) -# ${qos_tokens[3]/[-1] } = OSM.org exclusive / current -# ${qos_tokens[2]/[-2] } = tile.openstreetmap.org default -# ${qos_tokens[1]/[-3] } = stale ~ 1 hour +SECONDS_AGO=$((${NUM_TOKENS} * ${VALID_TOKEN})) +OLD_TIME=$(/bin/date -u "+%Y-%m-%dT %H:%M:%S %z" -d "${SECONDS_AGO} seconds ago") +QOS_TOKENS=($(/usr/bin/oathtool --totp --now="${OLD_TIME}" --window=${NUM_TOKENS} --time-step-size=${VALID_TOKEN}s -b "<%= @totp_key %>")) + +# ${qos_tokens[4]/[-1] } = OSM.org exclusive / current +# ${qos_tokens[3]/[-2] } = OSM.org exclusive / stale +# ${qos_tokens[2]/[-3] } = tile.openstreetmap.org default +# ${qos_tokens[1]/[-4] } = stale ~ 1 hour # ${qos_tokens[0]} = expired # Test if number of tokens returned by oathtool is expected number