Skip to content

Commit dc01040

Browse files
committed
group options together in custom
1 parent 4ca40f2 commit dc01040

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ and the [docker-lambda](https://github.com/lambci/docker-lambda) image.
3838
To enable docker usage, add the following to your `serverless.yml`:
3939
```yaml
4040
custom:
41-
dockerizePip: true
41+
pythonRequirements:
42+
dockerizePip: true
4243
```
4344

4445
## ZipImport!
@@ -48,7 +49,8 @@ and `scikit-learn`) there is support for having python import using
4849
add the following to your `serverless.yml`:
4950
```yaml
5051
custom:
51-
zipImport: true
52+
pythonRequirements:
53+
zipImport: true
5254
```
5355

5456

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ class ServerlessPythonRequirements {
3333
'-t', '.requirements',
3434
'-r', 'requirements.txt',
3535
];
36-
if (this.serverless.service.custom &&
37-
this.serverless.service.custom.dockerizePip) {
36+
if (this.custom.dockerizePip) {
3837
cmd = 'docker';
3938
options = [
4039
'run', '--rm',
@@ -56,7 +55,7 @@ class ServerlessPythonRequirements {
5655
packRequirements() {
5756
return this.installRequirements().then(() => {
5857
return new BbPromise((resolve, reject) => {
59-
if (this.serverless.service.custom && this.serverless.service.custom.zipImport) {
58+
if (this.custom.zipImport) {
6059
const zip = new Zip();
6160
zip.addLocalFolder('.requirements', '');
6261
zip.writeZip('.requirements.zip');
@@ -68,7 +67,7 @@ class ServerlessPythonRequirements {
6867

6968
cleanup() {
7069
const artifacts = ['requirements.py'];
71-
if (this.serverless.service.custom && this.serverless.service.custom.zipImport)
70+
if (this.custom.zipImport)
7271
artifacts.push('.requirements.zip')
7372
else
7473
artifacts.push('.requirements')
@@ -94,6 +93,7 @@ class ServerlessPythonRequirements {
9493
constructor(serverless, options) {
9594
this.serverless = serverless;
9695
this.options = options;
96+
this.custom = this.serverless.service.custom && this.serverless.service.custom.pythonRequirements || {};
9797

9898
this.commands = {
9999
'requirements': {

0 commit comments

Comments
 (0)