-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(Variables): Cover custom variable sources
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
test/fixtures/programmatic/plugin/custom-variable-source.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
|
||
module.exports = class CustomVariableSourcePlugin { | ||
constructor(serverless, options, utils) { | ||
this.serverless = serverless; | ||
this.options = options; | ||
this.utils = utils; | ||
this.configurationVariablesSources = { | ||
other: { | ||
async resolve({ address }) { | ||
// `address` contains the name of the variable to resolve: | ||
// In `${foo:some-variable}`, address will contain `some-variable`. | ||
|
||
// Resolver is expected to return an object with the value in the `value` property: | ||
return { | ||
// | ||
value: `Resolving variable ${address}`, | ||
}; | ||
}, | ||
}, | ||
}; | ||
} | ||
}; |
This file contains 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