Lullabot / lubot

1 stars 0 forks source link

Allow scripts to be disabled #16

Closed ericduran closed 1 year ago

ericduran commented 10 years ago

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.

justafish commented 10 years ago

Would setting this through an environment variable be ok?

q0rban commented 10 years ago

right now everything under script is automatically added.

This is how hubot works, too. Not the best, I agree.

sirkitree commented 10 years ago

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.

ericduran commented 10 years ago

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.

q0rban commented 10 years ago

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.

ericduran commented 10 years ago

that works too. just thinking out loud.

eojthebrave commented 9 years ago

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?

eojthebrave commented 9 years ago

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.

sirkitree commented 9 years ago

I'd prefer the second option

eojthebrave commented 9 years ago

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?

sirkitree commented 9 years ago

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

sirkitree commented 9 years ago

this uses the technique i'm referring to: https://github.com/sirkitree/pippi

sirkitree commented 9 years ago
var ConfigObj = require('./config')

and then config.json

{
    "config": {
        enabledScripts : {"karma", "taco_machine", "jacket_finder"}
    }
}
justafish commented 9 years ago

I would prefer a plain json file

eojthebrave commented 9 years ago

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.

justafish commented 9 years ago

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

ericduran commented 9 years ago

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
willwh commented 9 years ago

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:

willwh commented 9 years ago

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

lubot scripts

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
q0rban commented 9 years ago

@willwh it's simple. I like it!