diff --git a/mod/provider/cloudfront.js b/mod/provider/cloudfront.js index 59e39ad44..bc45241d5 100644 --- a/mod/provider/cloudfront.js +++ b/mod/provider/cloudfront.js @@ -11,7 +11,7 @@ module.exports = async ref => { try { // Subtitutes {*} with process.env.SRC_* key values. - const url = (ref.params?.url || ref).replace(/{(.*?)}/g, + const url = (ref.params?.url || ref).replace(/[{](.*?)[}]/g, matched => process.env[`SRC_${matched.replace(/(^{)|(}$)/g, '')}`]) const date = new Date(Date.now()) diff --git a/mod/provider/file.js b/mod/provider/file.js index 170a2882f..424f6c0c6 100644 --- a/mod/provider/file.js +++ b/mod/provider/file.js @@ -6,7 +6,7 @@ module.exports = async ref => { try { // Subtitutes {*} with process.env.SRC_* key values. - const path = (ref.params?.url || ref).replace(/{(.*?)}/g, + const path = (ref.params?.url || ref).replace(/[{](.*?)[}]/g, matched => process.env[`SRC_${matched.replace(/(^{)|(}$)/g, '')}`]) const file = readFileSync(join(__dirname, `../../${path}`))