-
Notifications
You must be signed in to change notification settings - Fork 88
Made 'originPath' configurable #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
82447dd
4f8918c
9dd19df
8f74381
fa203fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
/** | ||
* @Date: 2018-08-15T23:22:05+02:00 | ||
* @Last modified time: 2018-08-16T18:23:33+02:00 | ||
*/ | ||
|
||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, get rid of this meta data :) |
||
const path = require('path'); | ||
const _ = require('lodash'); | ||
const chalk = require('chalk'); | ||
|
@@ -98,7 +105,13 @@ class ServerlessApiCloudFrontPlugin { | |
} | ||
|
||
prepareOrigins(distributionConfig) { | ||
distributionConfig.Origins[0].OriginPath = `/${this.options.stage}`; | ||
const originPath = this.getConfig('originPath', `/${this.options.stage}`); | ||
|
||
if (originPath !== null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This comparison will always be true as I would suggest to get rid of it :) |
||
distributionConfig.Origins[0].OriginPath = originPath; | ||
} else { | ||
delete distributionConfig.Origins[0].OriginPath; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This
Please, get rid of it :) |
||
} | ||
} | ||
|
||
prepareCookies(distributionConfig) { | ||
|
@@ -108,10 +121,10 @@ class ServerlessApiCloudFrontPlugin { | |
distributionConfig.DefaultCacheBehavior.ForwardedValues.Cookies.WhitelistedNames = forwardCookies; | ||
} | ||
} | ||
|
||
prepareHeaders(distributionConfig) { | ||
const forwardHeaders = this.getConfig('headers', 'none'); | ||
|
||
if (Array.isArray(forwardHeaders)) { | ||
distributionConfig.DefaultCacheBehavior.ForwardedValues.Headers = forwardHeaders; | ||
} else { | ||
|
@@ -121,7 +134,7 @@ class ServerlessApiCloudFrontPlugin { | |
|
||
prepareQueryString(distributionConfig) { | ||
const forwardQueryString = this.getConfig('querystring', 'all'); | ||
|
||
if (Array.isArray(forwardQueryString)) { | ||
distributionConfig.DefaultCacheBehavior.ForwardedValues.QueryString = true; | ||
distributionConfig.DefaultCacheBehavior.ForwardedValues.QueryStringCacheKeys = forwardQueryString; | ||
|
@@ -154,7 +167,7 @@ class ServerlessApiCloudFrontPlugin { | |
delete distributionConfig.WebACLId; | ||
} | ||
} | ||
|
||
prepareCompress(distributionConfig) { | ||
distributionConfig.DefaultCacheBehavior.Compress = (this.getConfig('compress', false) === true) ? true : false; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,5 +28,6 @@ | |
"chalk": "^2.0.0", | ||
"js-yaml": "^3.10.0", | ||
"lodash": "^4.13.1" | ||
} | ||
}, | ||
"devDependencies": {} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get some additional description about this field? :)