Last active
August 29, 2015 14:11
-
-
Save double16/bf939ff5cb37c2a8f630 to your computer and use it in GitHub Desktop.
cdn-asset-pipeline Config.groovy snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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