Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Environment Variables #421

Merged
merged 4 commits into from
Jul 13, 2017
Merged

Environment Variables #421

merged 4 commits into from
Jul 13, 2017

Conversation

jonwinton
Copy link
Contributor

Per ticket.

Register the needed environment variables with Amphora at instantiation time:

   amphora({
      app: app,
      renderers: {
        html: amphoraHtml,
        default: 'html'
      },
      env: ['FOO', 'BAR']
    }).then(....)

These will then be resolved into an object when a page is requested for render only in edit mode. They will be sent in the _envVars property on the state object.

@mheiber
Copy link

mheiber commented Jul 13, 2017

trust no one with environment variables

@jonwinton jonwinton merged commit 5d566c8 into master Jul 13, 2017
@jonwinton jonwinton deleted the env-var-route branch July 13, 2017 13:59
function resolveEnvVars() {
var obj = {};

_.map(module.exports.envVars, function (val) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map is for transforming an array, but this just side-effects. You could use Array.prototype.forEach, _.each or some other _ method to better-communicate intent

*
* @param {Array} envArray
*/
function registerEnv(envArray) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this API documented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants