Skip to content

Commit

Permalink
Eliminate syncAPI option.
Browse files Browse the repository at this point in the history
Use oauth protected endpoint to get upload credentials.
  • Loading branch information
willwhite committed Mar 3, 2014
1 parent ff7b45b commit 5a40ec6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
3 changes: 1 addition & 2 deletions _posts/docs/reference/0204-05-01-exporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,7 @@ Options:
<tr><td><strong>--scale=</strong>[num] </td><td>Scale factor (Default: undefined)</td></tr>
<tr><td><strong>--concurrency=</strong>[num] </td><td>Number of exports that can be run concurrently. (Default: 4)</td></tr>
<tr><td><strong>--files=</strong>[path] </td><td>Path to files directory. (Default: "/home/aj/Documents/MapBox")</td></tr>
<tr><td><strong>--syncAPI=</strong>[URL] </td><td>MapBox API URL. (Default: "http://api.tiles.mapbox.com")</td></tr>
<tr><td><strong>--syncURL=</strong>[URL] </td><td>MapBox sync URL. (Default: "https://tiles.mapbox.com")</td></tr>
<tr><td><strong>--syncURL=</strong>[URL] </td><td>MapBox sync URL. (Default: "https://api.mapbox.com")</td></tr>
<tr><td><strong>--syncAccount=</strong>[account] </td><td>MapBox account name. (Default: "")</td></tr>
<tr><td><strong>--syncAccessToken=</strong>[token] </td><td>MapBox access token. (Default: "")</td></tr>
<tr><td><strong>--verbose=</strong>on|off </td><td>verbose logging (Default: "on")</td></tr>
Expand Down
13 changes: 6 additions & 7 deletions commands/export.bones
Original file line number Diff line number Diff line change
Expand Up @@ -587,13 +587,12 @@ command.prototype.upload = function (callback) {
handle: this.opts.project,
token: this.opts.syncAccessToken
});
var hash = crypto.createHash('md5')
.update(+new Date + '')
.digest('hex')
.substring(0, 6);
var policyEndpoint = url.format(_(url.parse(this.opts.syncAPI)).extend({
pathname: '/v2/'+ hash + '/upload.json'
}));
var policyEndpoint = _('<%=base%>/api/upload/<%=account%>?access_token=<%=token%>')
.template({
base: this.opts.syncURL,
account: this.opts.syncAccount,
token: this.opts.syncAccessToken
});

Step(function() {
request.get({
Expand Down
6 changes: 0 additions & 6 deletions commands/global.bones
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ Bones.Command.options['files'] = {
'default': defaults.files.replace(/^~/, process.env.HOME)
};

Bones.Command.options['syncAPI'] = {
'title': 'syncAPI=[URL]',
'description': 'MapBox API URL.',
'default': defaults.syncAPI || ''
};

Bones.Command.options['syncURL'] = {
'title': 'syncURL=[URL]',
'description': 'MapBox sync URL.',
Expand Down
1 change: 0 additions & 1 deletion lib/config.defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"sampledata": true,
"host": false,
"listenHost": "127.0.0.1",
"syncAPI": "http://api.tiles.mapbox.com",
"syncURL": "https://api.mapbox.com",
"server": false,
"verbose": "on"
Expand Down

0 comments on commit 5a40ec6

Please sign in to comment.