Skip to content

Instantly share code, notes, and snippets.

@double16
Last active August 29, 2015 14:11
Show Gist options
  • Save double16/bf939ff5cb37c2a8f630 to your computer and use it in GitHub Desktop.
Save double16/bf939ff5cb37c2a8f630 to your computer and use it in GitHub Desktop.
cdn-asset-pipeline Config.groovy snippet
def appName = grails.util.Metadata.current.'app.name'
def appVersion = grails.util.Metadata.current.'app.version'
def cdnAccessKey = System.getenv('CDN_AWS_ACCESS_KEY_ID')
def cdnSecretKey = System.getenv('CDN_AWS_SECRET_ACCESS_KEY')
if (cdnAccessKey && cdnSecretKey) {
grails {
assets {
cdn {
provider = 's3' // Karman provider
directory = ‘mybucket’
accessKey = cdnAccessKey
secretKey = cdnSecretKey
storagePath = "assets/${appName}-${appVersion}/"
region = 'us-east-1'
expires = 365 // Expires in 1 year (value in days)
gzip = true // save compressed files, improves download speed
}
}
}
}
environments { production {
grails.assets.url = "https://s3.amazonaws.com/mybucket/assets/${appName}-${appVersion}/"
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment