Open cburschka opened 9 years ago
It seems to work via a REST HTTP API. Since we're in a shell script, the easiest way to interact with it might be curl:
http://blog.scottlowe.org/2014/02/19/using-curl-to-interact-with-a-restful-api/
Something like
curl \
--request DELETE \
--header "X-Auth-Token: <auth-token>" \
--header "X-Purge-Email: <user@domain.com>" \
https://cdn.clouddrive.com/v1/<account-id>/<container>/<object>
(For security, the auth token should probably be read from a file that isn't hosted on github. :P )
Eg.
CDN_AUTH=$(cat .cdn_auth)
CDN_MAIL=$(cat .cdn_mail)
curl \
--request DELETE \
--header "X-Auth-Token: $CDN_AUTH" \
--header "X-Purge-Email: $CDN_MAIL" \
https://cdn.clouddrive.com/v1/<account-id>/<container>/<object>
We're now using amazon s3/cloudfront for CDN over rackspace, however the aws cli does have an included feature (albeit experimental): http://docs.aws.amazon.com/cli/latest/reference/cloudfront/create-invalidation.html
Let's see how that works. Because waiting nearly an hour for the CDN cache to expire after the local content has already updated is bad. In the best case scenario, the local resources haven't changed significantly and your update is just delayed. In the worst case, the new local files are incompatible with the old CDN resources, and you're left with a broken client until it updates. (I think this has happened before.)