Skip to content

Commit 87587e8

Browse files
committed
We have a Fastly staging service, use it.
Set environment variable which we can then use in tasks to do logic on a per environment basis. Actually purge the correct CDN hostnames for a given environment.
1 parent 40e8afd commit 87587e8

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

cdn.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99
def fastly_purge(*args):
1010
"Purge items from Fastly, eg \"/one,/two,/three\". Wildcards not supported."
1111
govuk_fastly = 'http://www-gov-uk.map.fastly.net'
12-
hostnames_to_purge = ['www.gov.uk', 'assets.digital.cabinet-office.gov.uk']
12+
if env.environment == 'production':
13+
hostnames_to_purge = ['www.gov.uk', 'assets.digital.cabinet-office.gov.uk']
14+
elif env.environment == 'staging':
15+
# FIXME - Staging Fastly service should point to non alphagov.co.uk
16+
# domains and amended here after the miration to Carrenza
17+
hostnames_to_purge = ['www.staging.alphagov.co.uk', 'assets.staging.alphagov.co.uk']
18+
1319
for path in args:
1420
if "*" in path:
1521
abort("Sorry, purging paths containing wildcards is not supported "

fabfile.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,21 +231,25 @@ def help(name):
231231
@task
232232
def production():
233233
"""Select production environment"""
234+
env['environment'] = 'production'
234235
_set_gateway('production.alphagov.co.uk')
235236

236237
@task
237238
def production_migration():
238239
"""Select production migration environment"""
240+
env['environment'] = 'production'
239241
_set_gateway('publishing.service.gov.uk')
240242

241243
@task
242244
def staging():
243245
"""Select staging environment"""
246+
env['environment'] = 'staging'
244247
_set_gateway('staging.publishing.service.gov.uk')
245248

246249
@task
247250
def preview():
248251
"""Select preview environment"""
252+
env['environment'] = 'preview'
249253
_set_gateway('preview.alphagov.co.uk')
250254

251255
@task

0 commit comments

Comments
 (0)