-
Notifications
You must be signed in to change notification settings - Fork 0
feat: support on templating env for route inputs #8
base: main
Are you sure you want to change the base?
Conversation
4045413
to
296260f
Compare
app.js
Outdated
console.log('FATAL', 'Set NODE_ENV to production or development or add', configPath); | ||
throw new Error(msg); | ||
} | ||
throw new Error(err.message); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw new Error(err.message); | |
throw err; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To remove block. We won't be using config files instead as per discussion.
app.js
Outdated
const cwd = process.cwd(); | ||
const NODE_ENV = process.env.NODE_ENV || 'development'; | ||
const CONFIG_BASE_PATH = process.env.CONFIG_BASE_PATH || './config'; | ||
const configFileName = `${NODE_ENV}.json`; | ||
|
||
let configPath; | ||
if (path.isAbsolute(CONFIG_BASE_PATH)) { | ||
configPath = path.normalize(CONFIG_BASE_PATH) + path.sep + configFileName; | ||
} else { | ||
configPath = CONFIG_BASE_PATH + '/' + configFileName; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? If we really have to validate the config, I'd rather we check the values of what exp-config
returns than just checking whether the config file exists since the values are more important.
I suggest removing this file validation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To remove block. We won't be using config files instead as per discussion.
functions/ldap.js
Outdated
@@ -14,6 +16,8 @@ exports.plugin = { | |||
name: 'ldap', | |||
register: async function (server) { | |||
server.ext('onRequest', (request, h) => { | |||
helpers.setQueryParameterTemplateValues(request.query, config.ldap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helpers.setQueryParameterTemplateValues(request.query, config.ldap); | |
helpers.setQueryParameterTemplateValues(request.query, config.ldap); |
Is request.query
at this point an object or still the serialized string value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
request.query is already an object at this point
Problem/Issue:
Supporting templating ENV for input in hub-functions. Instead of sending in secrets etc via payload or query, we need to support templating, with handlebars.
Trello issue here
Proposed Solution:
Implement interpolation mechanism from environment variables using handlebars library for http request inputs.