Skip to content

Commit 0ef872f

Browse files
authored
Skip CDN requests when secrets are unset (#260)
1 parent 3d068f4 commit 0ef872f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: build_docs.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1300,8 +1300,13 @@ def purge_surrogate_key(http: urllib3.PoolManager, surrogate_key: str) -> None:
13001300
13011301
https://www.fastly.com/documentation/reference/api/purging/#purge-tag
13021302
"""
1303-
service_id = os.environ.get("FASTLY_SERVICE_ID", "__UNSET__")
1304-
fastly_key = os.environ.get("FASTLY_TOKEN", "__UNSET__")
1303+
unset = "__UNSET__"
1304+
service_id = os.environ.get("FASTLY_SERVICE_ID", unset)
1305+
fastly_key = os.environ.get("FASTLY_TOKEN", unset)
1306+
1307+
if service_id == unset or fastly_key == unset:
1308+
logging.info("CDN secrets not set, skipping Surrogate-Key purge")
1309+
return
13051310

13061311
logging.info("Purging Surrogate-Key '%s' from CDN", surrogate_key)
13071312
http.request(

0 commit comments

Comments
 (0)