Skip to content

Commit

Permalink
Support pathPrefix for shared webservers (fix #56)
Browse files Browse the repository at this point in the history
  • Loading branch information
gjsjohnmurray committed Jun 24, 2024
1 parent 50c52be commit e22979c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions connection.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,23 @@
"enum": ["Server and Port"]
},
"server": {
"title": "Server Address",
"title": "Webserver address",
"type": "string",
"minLength": 1,
"default": "localhost"
},
"port": {
"title": "WebServer Port",
"title": "Webserver port",
"minimum": 1,
"default": 52773,
"type": "integer"
},
"pathPrefix": {
"title": "Path prefix (for shared webserver)",
"type": "string",
"pattern": "^(|\/.*[^\/])$",
"default": ""
},
"https": {
"title": "Use HTTPS",
"default": false,
Expand Down
4 changes: 2 additions & 2 deletions src/ls/irisdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class IRISdb {
params?: any,
headers?: any
): Promise<any> {
const { https, host, port, username, password } = this.config;
const { https, host, port, pathPrefix, username, password } = this.config;
if (minVersion > this.apiVersion) {
return Promise.reject(`${path} not supported by API version ${this.apiVersion}`);
}
Expand Down Expand Up @@ -95,7 +95,7 @@ export default class IRISdb {
maxSockets: 10,
rejectUnauthorized: https,
});
path = encodeURI(`/api/atelier/${path || ""}${buildParams()}`);
path = encodeURI(`${pathPrefix || ""}/api/atelier/${path || ""}${buildParams()}`);

const cookies = this.cookies;
let auth;
Expand Down

0 comments on commit e22979c

Please sign in to comment.