Skip to content
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

Implement Feature Request: Add custom fields to define index and error documents #20

Merged
merged 4 commits into from
Feb 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ custom:
client:
bucketName: unique-s3-bucketname-for-your-website-files
distributionFolder: client/dist # (Optional) The location of your website. This defaults to client/dist
indexDocument: index.html # (Optional) The name of your index document inside your distributionFolder. Defaults to index.html
errorDocument: error.html # (Optional) The name of your error document inside your distributionFolder. Defaults to error.html
```

* **Warning:** The plugin will overwrite any data you have in the bucket name you set above if it already exists.
Expand Down Expand Up @@ -78,5 +80,6 @@ serverless client remove
- [pradel](https://github.com/pradel)
- [daguix](https://github.com/daguix)
- [shentonfreude](https://github.com/shentonfreude)
- [evanseeds](https://github.com/evanseeds)

Forked from the [**serverless-client-s3**](https://github.com/serverless/serverless-client-s3/)
7 changes: 5 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,14 @@ class Client {
function configureBucket() {
this.serverless.cli.log(`Configuring website bucket ${this.bucketName}...`);

const indexDoc = this.serverless.service.custom.client.indexDocument || 'index.html'
const errorDoc = this.serverless.service.custom.client.errorDocument || 'error.html'

let params = {
Bucket: this.bucketName,
WebsiteConfiguration: {
IndexDocument: { Suffix: 'index.html' },
ErrorDocument: { Key: 'error.html' }
IndexDocument: { Suffix: indexDoc },
ErrorDocument: { Key: errorDoc }
}
};

Expand Down