Skip to content

Commit 25ba58f

Browse files
author
Rudy Weber
committed
expose custom prefix option
1 parent 6d531dd commit 25ba58f

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/platformsh.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ function decode(value) {
2424
*/
2525
class Config {
2626

27-
constructor(env = null, prefix = 'PLATFORM_') {
27+
constructor(env = null, varPrefix = 'PLATFORM_') {
2828
this.environmentVariables = env || process.env;
29-
this.envPrefix = prefix;
29+
this.varPrefix = varPrefix;
3030

3131
// Node doesn't support pre-defined object properties in classes, so
3232
// this is mostly for documentation but also to ensure there's always
@@ -567,7 +567,7 @@ class Config {
567567
* @return {string|null}
568568
*/
569569
_getValue(name) {
570-
let checkName = this.envPrefix + name.toUpperCase();
570+
let checkName = this.varPrefix + name.toUpperCase();
571571

572572
return this.environmentVariables[checkName] || null;
573573
}
@@ -619,9 +619,9 @@ function puppeteerFormatter(credentials) {
619619
*
620620
* @returns {Config}
621621
*/
622-
function config() {
622+
function config({ varPrefix } = {}) {
623623

624-
return new Config();
624+
return new Config(null, varPrefix);
625625
}
626626

627627
module.exports = {

0 commit comments

Comments
 (0)