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

Use require to load defaults once #14

Closed
wants to merge 2 commits into from

Conversation

bkeepers
Copy link
Contributor

This updates the loading of defaults to be called once using require instead of with JSON.parse(fs.readFileSync(xxx)). It's a little bit cleaner looking, and avoids a synchronous filesystem read on every event.

Copy link
Contributor Author

@bkeepers bkeepers left a comment

Choose a reason for hiding this comment

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

@jbjonesjr I pushed another commit to this branch that moves the defaults from etc/defaults.json to lib/defaults.js. The primary motivation was to allow environment variables to be evaluated in the defaults.

@@ -0,0 +1,7 @@
module.exports = {
probotUsername: (process.env.APP_NAME || 'probot-snooze') + '[bot]',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Workaround until #12 is implemented.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jbjonesjr oh, I forgot, this was the actual motivation for making this change. The bot name needs to be configurable until #12 is fixed. Would you reconsider this PR for that reason?

@jbjonesjr
Copy link
Owner

we talked through this in 🍖 -space.

@jbjonesjr jbjonesjr closed this Sep 8, 2017
@bkeepers bkeepers deleted the require-defaults branch October 19, 2017 14:18
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.

None yet

2 participants