mozilla / idea-town-addon

DEPRECATED: see idea-town repo
https://github.com/mozilla/idea-town/tree/master/addon
Mozilla Public License 2.0
2 stars 4 forks source link

Cleanly switch between dev and prod prefs #29

Open jaredhirsch opened 9 years ago

jaredhirsch commented 9 years ago

The jpm package seems to assume that prefs live in package.json. What, then, is a clean way to toggle between dev and prod URLs?

Do we want to build package.json from several other files?

Or, maybe we want to have package.json.dev and package.json.prod, and some build process copies one or the other to package.json, so that jpm can see it?

Or maybe we just always build the addon using the prod settings, then go into FF and manually set prefs in about:config?

¯(ツ)

This bug covers figuring out the most add-on idiomatic way of toggling prefs, and then implementing it.

lmorchard commented 9 years ago

Or maybe we just always build the add-on using the prod settings, then go into FF and manually set prefs in about:config?

I think that's it. The prefs in package.json are just initial defaults - and it seems like prod settings would be the best defaults for shipping. Then, you can overlay dev-specific things in local profile via about:config. (Maybe even with a second add-on that configures everything for you. (yo dawg))

lmorchard commented 9 years ago

Here's what might be a crazy idea: What if the idea town addon listens for client messages from the known hosts for prod, dev, staging, local dev, etc? One of the messages on login could supply the addon with config details for that server - API endpoint, etc. Then, when you login, the addon can auto-configure itself for that particular server.

I think the big caveat for this is that devs should really use a different Firefox profile for working on each server environment. Could also have the addon present a quick confirmation dialog on environment change, something like "You just logged into Idea Town {Dev,Staging,Local} - do you want to configure Firefox for this instance? [yes] [no]"

pdehaan commented 9 years ago

IIUC, jpm allows you to set the prefs location via the --prefs flag: https://github.com/mozilla-jetpack/jpm#usage

That may make it marginally easier to separate the dev vs prod logic into separate files, and then we could use convict to choose the correct config file location based on Node env.