Closed ericduran closed 1 year ago
Would setting this through an environment variable be ok?
right now everything under script is automatically added.
This is how hubot works, too. Not the best, I agree.
ircjs has a config file in which you define which plugins you want for a given bot. I don't see why setting a variable wouldn't be okay.
So setting a variable works for me but here's a crazy idea.
Why not let npm manage the scripts for you.
If I happen to npm install lubot-github then I expect GitHub integration. If not then it shouldn't and won't know about it.
This is more node-ish. Either way works for me. I just like the idea of packaging the scripts completely separate.
I think letting npm manage them is annoying. Then you have to have separate repositories for each script.
The way hubot-scripts works is you have a json array of scripts you want to use.
that works too. just thinking out loud.
Okay.
LUBOT_ENABLED_SCRIPTS="*";
or
LUBOT_ENABLED_SCRIPTS="karma,github,taco_machine";
v.s. something like
/config.js
config.enabledScripts = {"karma", "taco_machine", "jacket_finder"};
Thoughts?
All of our config is in environment variables right now, so maybe stick to that?
Though I honestly don't love the use of environment variables since they are not explicitly documented.
I'd prefer the second option
Maybe use something like nconf? https://github.com/flatiron/nconf
@q0rban was poking around with this for tugboat. Is it a good fit for configuration storage here?
I don't really see the need for an extra lib. it's very easy to just write a json file and require it.
i'll find a sample
this uses the technique i'm referring to: https://github.com/sirkitree/pippi
var ConfigObj = require('./config')
and then config.json
{
"config": {
enabledScripts : {"karma", "taco_machine", "jacket_finder"}
}
}
I would prefer a plain json file
I don't like JSON for this kind of thing because you can't put comments in a JSON file.
Personally, I like having the documentation for setting reside with the setting itself. Kind of like Drupal's settings.php
file.
How about a .js file that exports an object in CommonJS style? e.g. https://github.com/Lullabot/lullabot.com-www/blob/master/settings.js
How about yml?
Just like the config.json except it'll have comment support and simpler than json.
We do something similar in our pubstack:
synced_folder: ~/Sites/nbcu
memory: 2048
cpus: 2
sites:
- subscription: nbcupublisher7
shortname: nbcupublisher7
vhost:
servername: local.publisher7.com
documentroot: Publisher7/docroot
- subscription: nbcunbc
shortname: nbcunbc
vhost:
servername: local.nbc.com
documentroot: Publisher7_nbc/docroot
config:
nodejs: true
phantomjs: true
ruby: true
splunk: true
This looks like we could get 'er done real quick:
https://www.npmjs.com/package/node-yaml-config
Definitely love the yaml idea, @ericduran :+1:
I actually opted for this option with our drupalize.me branch (for the moment)
https://github.com/Lullabot/lubot/commit/5a8eea49d1fabb385ef7b5a810cfa82d05679338
Please see the README.md
Scripts are loaded from this autorun directory
Simply symlink the scripts you need from ~/scripts like so:
cd ~/scripts/autorun
ln -s ../your_desired_script.js
@willwh it's simple. I like it!
right now everything under script is automatically added.
This was a hassle for me since I didn't want the github integration :-/ had to remove the file.
Super low priority.