Remove config urls abs url map

This commit is contained in:
Juan Cruz Viotti 2014-12-01 10:11:00 -04:00
parent d3eac45955
commit e21c1588c9
3 changed files with 17 additions and 18 deletions

View File

@ -1,3 +1,4 @@
url = require('url')
open = require('open')
async = require('async')
resin = require('../resin')
@ -20,4 +21,6 @@ exports.logout = ->
resin.auth.logout()
exports.signup = ->
open(resin.config.urls.signup)
signupUrl = resin.config.urls.signup
absUrl = url.resolve(resin.config.remoteUrl, signupUrl)
open(absUrl)

View File

@ -1,5 +1,8 @@
open = require('open')
url = require('url')
resin = require('../resin')
exports.preferences = ->
open(resin.config.urls.preferences)
preferencesUrl = resin.config.urls.preferences
absUrl = url.resolve(resin.config.remoteUrl, preferencesUrl)
open(absUrl)

View File

@ -1,5 +1,3 @@
_ = require('lodash')
url = require('url')
path = require('path')
config =
@ -21,20 +19,15 @@ config =
events:
deviceLogs: 'device-<%= uuid %>-logs'
urls:
signup: '/signup'
preferences: '/preferences'
keys: '/user/keys'
identify: '/blink'
authenticate: '/login_'
applicationRestart: '/application/<%= id %>/restart'
sshKey: '/user/keys/<%= id %>'
config.pluginsDirectory = path.join(config.dataPrefix, 'plugins')
config.urls =
signup: '/signup'
preferences: '/preferences'
keys: '/user/keys'
identify: '/blink'
authenticate: '/login_'
applicationRestart: '/application/<%= id %>/restart'
sshKey: '/user/keys/<%= id %>'
# Append config.remoteUrl before every url
config.urls = _.object _.map config.urls, (value, key, object) ->
absUrl = url.resolve(config.remoteUrl, value)
return [ key, unescape(absUrl) ]
module.exports = config