mckelvey / instagram-node-lib

The Instagram Node Lib is a helper library for node that makes communicating with the Instagram API easy.
http://david.mckelveycreative.com/
Other
303 stars 49 forks source link

Remove process.ENV #11

Open mwawrusch opened 11 years ago

mwawrusch commented 11 years ago

This code block

  client_id: if process.env['CLIENT_ID']? then process.env['CLIENT_ID'] else 'CLIENT-ID'
  client_secret: if process.env['CLIENT_SECRET']? then process.env['CLIENT_SECRET'] else 'CLIENT-SECRET'
  callback_url: if process.env['CALLBACK_URL']? then process.env['CALLBACK_URL'] else 'CALLBACK-URL'
  redirect_uri: if process.env['REDIRECT_URI']? then process.env['REDIRECT_URI'] else 'REDIRECT_URI'
  access_token: if process.env['ACCESS_TOKEN']? then process.env['ACCESS_TOKEN'] else null

is really dangerous, as it can easily introduce side effects in larger apps. Best to remove it and pass this simply as an object. Most people will want to use something like nconf to read from a config file and set the the parameters accordingly.