Skip to content

Commit

Permalink
Merge branch 'fix/gallery-endpoints'
Browse files Browse the repository at this point in the history
  • Loading branch information
tamorim committed Mar 1, 2016
2 parents fb974d3 + 7055e90 commit abe9b41
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/lib/auth/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function userAuth(result) {
export function createWorkspace(credentials) {
let deferred = Q.defer();
let options = {
url: 'http://api.beta.vtex.com/' + credentials.account + '/workspaces',
url: 'http://workspaces.vtex.com/' + credentials.account + '/workspaces',
method: 'POST',
headers: {
Authorization: 'token ' + credentials.token,
Expand Down
3 changes: 2 additions & 1 deletion src/lib/file-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export function listFiles() {
deferred.resolve({
files: files,
ignore: ignoredPatterns,
endpoint: requestConfig.GalleryEndpoint,
appsEndpoint: requestConfig.AppsEndpoint,
workspacesEndpoint: requestConfig.WorkspacesEndpoint,
header: requestConfig.AcceptHeader
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/lib/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function pushApp(app, version, vendor, credentials) {
return getRequestConfig().then((config) => {
let deferred = Q.defer();

const url = config.GalleryEndpoint || 'http://api.beta.vtex.com';
const url = config.AppsEndpoint || 'http://apps.vtex.com';
const acceptHeader = config.AcceptHeader || 'application/vnd.vtex.gallery.v0+json';
let formData = {
attachments: [fs.createReadStream(getZipFilePath(app, version))]
Expand Down
14 changes: 8 additions & 6 deletions src/lib/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ class Watcher {
this.credentials = credentials;
this.isServerSet = isServerSet;

this.endpoint = 'http://api.beta.vtex.com';
this.appsEndpoint = 'http://apps.vtex.com';
this.workspacesEndpoint = 'http://workspaces.vtex.com';
this.acceptHeader = 'application/vnd.vtex.workspaces.v0+json';
this.sandbox = this.credentials.email;
this.workspace = 'sb_' + this.credentials.email;
Expand Down Expand Up @@ -55,7 +56,8 @@ class Watcher {
return listFiles().then((result) => {
let deferred = Q.defer();

if (result.endpoint) this.endpoint = result.endpoint;
if (result.appsEndpoint) this.appsEndpoint = result.appsEndpoint;
if (result.workspacesEndpoint) this.workspacesEndpoint = result.workspacesEndpoint;
if (result.header) this.acceptHeader = result.header;

let ignore = [];
Expand Down Expand Up @@ -176,7 +178,7 @@ class Watcher {
};

let options = {
url: this.endpoint + '/' + this.vendor + '/sandboxes/' + this.sandbox + '/' + this.app + '/files',
url: this.appsEndpoint + '/' + this.vendor + '/sandboxes/' + this.sandbox + '/' + this.app + '/files',
method: 'POST',
json: galleryObj,
headers: {
Expand Down Expand Up @@ -277,7 +279,7 @@ class Watcher {

getSandboxFiles = () => {
let options = {
url: this.endpoint + '/' + this.vendor + '/sandboxes/' + this.sandbox + '/' + this.app + '/files',
url: this.appsEndpoint + '/' + this.vendor + '/sandboxes/' + this.sandbox + '/' + this.app + '/files',
method: 'GET',
headers: {
Authorization: 'token ' + this.credentials.token,
Expand Down Expand Up @@ -397,7 +399,7 @@ class Watcher {
activateSandbox = () => {
let deferred = Q.defer();
let options = {
url: (this.endpoint + '/' + this.credentials.account + '/workspaces/' + this.workspace + '/') + ('sandboxes/' + this.vendor + '/' + this.credentials.email + '/apps/' + this.app),
url: (this.workspacesEndpoint + '/' + this.credentials.account + '/workspaces/' + this.workspace + '/') + ('sandboxes/' + this.vendor + '/' + this.credentials.email + '/apps/' + this.app),
method: 'PUT',
headers: {
Authorization: 'token ' + this.credentials.token,
Expand All @@ -420,7 +422,7 @@ class Watcher {

deactivateSandbox = () => {
let options = {
url: (this.endpoint + '/' + this.credentials.account + '/workspaces/' + this.workspace + '/') + ('sandboxes/' + this.vendor + '/' + this.credentials.email + '/apps/' + this.app),
url: (this.workspacesEndpoint + '/' + this.credentials.account + '/workspaces/' + this.workspace + '/') + ('sandboxes/' + this.vendor + '/' + this.credentials.email + '/apps/' + this.app),
method: 'DELETE',
headers: {
Authorization: 'token ' + this.credentials.token,
Expand Down

0 comments on commit abe9b41

Please sign in to comment.