1
0
mirror of https://github.com/bigchaindb/site.git synced 2025-02-14 21:10:28 +01:00
This commit is contained in:
Matthias Kretschmann 2018-02-01 11:30:29 +01:00
parent bc756270c7
commit f56b7068c2
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -365,97 +365,92 @@ export default dev
// gulp deploy --beta // gulp deploy --beta
// gulp deploy --gamma // gulp deploy --gamma
// //
export const s3 = () => { // create publisher, define config
if ($.util.env.live === true) {
// create publisher, define config var publisher = $.awspublish.create({
if ($.util.env.live === true) { params: { 'Bucket': S3BUCKET },
var publisher = $.awspublish.create({ 'accessKeyId': process.env.AWS_ACCESS_KEY,
params: { 'Bucket': S3BUCKET }, 'secretAccessKey': process.env.AWS_SECRET_KEY,
'accessKeyId': process.env.AWS_ACCESS_KEY, 'region': S3REGION
'secretAccessKey': process.env.AWS_SECRET_KEY, })
'region': S3REGION } else if ($.util.env.beta === true) {
}) var publisher = $.awspublish.create({
} else if ($.util.env.beta === true) { params: { 'Bucket': S3BUCKET_BETA },
var publisher = $.awspublish.create({ 'accessKeyId': process.env.AWS_BETA_ACCESS_KEY,
params: { 'Bucket': S3BUCKET_BETA }, 'secretAccessKey': process.env.AWS_BETA_SECRET_KEY,
'accessKeyId': process.env.AWS_BETA_ACCESS_KEY, 'region': S3REGION_BETA
'secretAccessKey': process.env.AWS_BETA_SECRET_KEY, })
'region': S3REGION_BETA } else if ($.util.env.gamma === true) {
}) var publisher = $.awspublish.create({
} else if ($.util.env.gamma === true) { params: { 'Bucket': S3BUCKET_GAMMA },
var publisher = $.awspublish.create({ 'accessKeyId': process.env.AWS_GAMMA_ACCESS_KEY,
params: { 'Bucket': S3BUCKET_GAMMA }, 'secretAccessKey': process.env.AWS_GAMMA_SECRET_KEY,
'accessKeyId': process.env.AWS_GAMMA_ACCESS_KEY, 'region': S3REGION_GAMMA
'secretAccessKey': process.env.AWS_GAMMA_SECRET_KEY, })
'region': S3REGION_GAMMA
})
} else {
return
}
return src(DIST + '**/*')
.pipe($.awspublishRouter({
cache: {
// cache for 5 minutes by default
cacheTime: 300
},
routes: {
// all static assets, cached & gzipped
'^assets/(?:.+)\\.(?:js|css|png|jpg|jpeg|gif|ico|svg|ttf|eot|woff|woff2)$': {
cacheTime: 2592000, // cache for 1 month
gzip: true
},
// every other asset, cached
'^assets/.+$': {
cacheTime: 2592000 // cache for 1 month
},
// all html files, not cached & gzipped
'^.+\\.html': {
cacheTime: 0,
gzip: true
},
// all pdf files, not cached
'^.+\\.pdf': {
cacheTime: 0
},
// all zip files, not cached
'^.+\\.zip': {
cacheTime: 0
},
// font mime types
'\.ttf$': {
key: '$&',
headers: { 'Content-Type': 'application/x-font-ttf' }
},
'\.woff$': {
key: '$&',
headers: { 'Content-Type': 'application/x-font-woff' }
},
'\.woff2$': {
key: '$&',
headers: { 'Content-Type': 'application/x-font-woff2' }
},
// pass-through for anything that wasn't matched by routes above, to be uploaded with default options
"^.+$": "$&"
}
}))
// Make sure everything goes to the root '/'
.pipe($.rename(path => {
path.dirname = '/' + path.dirname
}))
.pipe(parallelize(publisher.publish(), 100))
.pipe(publisher.sync()) // delete files in bucket that are not in local folder
.pipe($.awspublish.reporter({
states: ['create', 'update', 'delete']
}))
} }
export const s3 = () => src(DIST + '**/*')
.pipe($.awspublishRouter({
cache: {
// cache for 5 minutes by default
cacheTime: 300
},
routes: {
// all static assets, cached & gzipped
'^assets/(?:.+)\\.(?:js|css|png|jpg|jpeg|gif|ico|svg|ttf|eot|woff|woff2)$': {
cacheTime: 2592000, // cache for 1 month
gzip: true
},
// every other asset, cached
'^assets/.+$': {
cacheTime: 2592000 // cache for 1 month
},
// all html files, not cached & gzipped
'^.+\\.html': {
cacheTime: 0,
gzip: true
},
// all pdf files, not cached
'^.+\\.pdf': {
cacheTime: 0
},
// all zip files, not cached
'^.+\\.zip': {
cacheTime: 0
},
// font mime types
'\.ttf$': {
key: '$&',
headers: { 'Content-Type': 'application/x-font-ttf' }
},
'\.woff$': {
key: '$&',
headers: { 'Content-Type': 'application/x-font-woff' }
},
'\.woff2$': {
key: '$&',
headers: { 'Content-Type': 'application/x-font-woff2' }
},
// pass-through for anything that wasn't matched by routes above, to be uploaded with default options
'^.+$': '$&'
}
}))
// Make sure everything goes to the root '/'
.pipe($.rename(path => {
path.dirname = '/' + path.dirname
}))
.pipe(parallelize(publisher.publish(), 100))
.pipe(publisher.sync()) // delete files in bucket that are not in local folder
.pipe($.awspublish.reporter({
states: ['create', 'update', 'delete']
}))
// //
// Ping search engines on live deployment // Ping search engines on live deployment