Closed taijinlee closed 12 years ago
Two ways of approaching this that I can think of.
1) Have app/server.js generate a static config file in /web/js/ and the client would just pick it up as a statically served file.
app/server.js
/web/js/
2) Have an api exposed for getting the current config -- /api/config or something like that
/api/config
I think I prefer 2, but I can be swayed that 1 is better if you can think of any reasons.
In terms of all the pieces necessary, I'm currently using node-config for config files. I think we might want to abstract the config more, into a small wrapper so that we can use makeHidden only in our wrapper. http://lorenwest.github.com/node-config/latest/Config.html
makeHidden
Example, drop this in app/server.js
config.makeHidden(config.githubOauth, 'secret'); console.log(JSON.stringify(config.githubOauth.secret)); console.log(JSON.stringify(config));
I realized that by exposing an API we don't need to do this makeHidden thing, just have to make force specification on which fields are exposed. Woot.
Two ways of approaching this that I can think of.
1) Have
app/server.js
generate a static config file in/web/js/
and the client would just pick it up as a statically served file.2) Have an api exposed for getting the current config --
/api/config
or something like thatI think I prefer 2, but I can be swayed that 1 is better if you can think of any reasons.
In terms of all the pieces necessary, I'm currently using node-config for config files. I think we might want to abstract the config more, into a small wrapper so that we can use
makeHidden
only in our wrapper. http://lorenwest.github.com/node-config/latest/Config.htmlExample, drop this in app/server.js