Skip to content

Commit

Permalink
Fixes #104 - allow using / location in custom location
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Curnow committed May 8, 2019
1 parent 4d5adef commit 22e8961
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 9 additions & 1 deletion src/backend/internal/nginx.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ const internalNginx = {

renderedLocations += await renderer.parseAndRender(template, locationCopy);
}
}
};

locationRendering().then(() => resolve(renderedLocations));
});
Expand Down Expand Up @@ -211,6 +211,14 @@ const internalNginx = {
locationsPromise = internalNginx.renderLocations(host).then((renderedLocations) => {
host.locations = renderedLocations;
});

// Allow someone who is using / custom location path to use it, and skip the default / location
_.map(host.locations, (location) => {
if (location.path === '/') {
host.use_default_location = false;
}
});

} else {
locationsPromise = Promise.resolve();
}
Expand Down
10 changes: 5 additions & 5 deletions src/backend/internal/proxy-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const internalProxyHost = {
}

return access.can('proxy_hosts:create', data)
.then(access_data => {
.then(() => {
// Get a list of the domain names and check each of them against existing records
let domain_name_check_promises = [];

Expand All @@ -52,7 +52,7 @@ const internalProxyHost = {
.omit(omissions())
.insertAndFetch(data);
})
.then(row => {
.then((row) => {
if (create_certificate) {
return internalCertificate.createQuickCertificate(access, data)
.then(cert => {
Expand All @@ -69,21 +69,21 @@ const internalProxyHost = {
return row;
}
})
.then(row => {
.then((row) => {
// re-fetch with cert
return internalProxyHost.get(access, {
id: row.id,
expand: ['certificate', 'owner', 'access_list']
});
})
.then(row => {
.then((row) => {
// Configure nginx
return internalNginx.configure(proxyHostModel, 'proxy_host', row)
.then(() => {
return row;
});
})
.then(row => {
.then((row) => {
// Audit log
data.meta = _.assign({}, data.meta || {}, row.meta);

Expand Down

0 comments on commit 22e8961

Please sign in to comment.