Skip to content

Commit e838581

Browse files
committed
Merge pull request #108 from shaunburdick/add-base
Add option base path
2 parents e2395e4 + 3a6c7b8 commit e838581

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ JiraApi options:
8484
* `Jira API Version<string>`: Known to work with `2` and `2.0.alpha1`
8585
* `verbose<bool>`: Log some info to the console, usually for debugging
8686
* `strictSSL<bool>`: Set to false if you have self-signed certs or something non-trustworthy
87+
* `oauth`: A dictionary of `consumer_key`, `consumer_secret`, `access_token` and `access_token_secret` to be used for OAuth authentication.
88+
* `base<string>`: A base slug if your JIRA instance is not at the root of `host`
8789

8890
## Implemented APIs ##
8991

lib/jira.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@
4949
// * `Jira API Version<string>`: Known to work with `2` and `2.0.alpha1`
5050
// * `verbose<bool>`: Log some info to the console, usually for debugging
5151
// * `strictSSL<bool>`: Set to false if you have self-signed certs or something non-trustworthy
52-
// * `oauth`: A dictionary of `consumer_key`, `consumer_secret`, `access_token` and `access_token_secret` to be used for OAuth authentication.
52+
// * `oauth`: A dictionary of `consumer_key`, `consumer_secret`, `access_token` and `access_token_secret` to be used for OAuth authentication.
53+
// * `base`: Add base slug if your JIRA install is not at the root of the host
5354
//
5455
// ## Implemented APIs ##
5556
//
@@ -132,13 +133,14 @@ var url = require('url'),
132133
OAuth = require("oauth");
133134

134135

135-
var JiraApi = exports.JiraApi = function(protocol, host, port, username, password, apiVersion, verbose, strictSSL, oauth) {
136+
var JiraApi = exports.JiraApi = function(protocol, host, port, username, password, apiVersion, verbose, strictSSL, oauth, base) {
136137
this.protocol = protocol;
137138
this.host = host;
138139
this.port = port;
139140
this.username = username;
140141
this.password = password;
141142
this.apiVersion = apiVersion;
143+
this.base = base;
142144
// Default strictSSL to true (previous behavior) but now allow it to be
143145
// modified
144146
if (strictSSL == null) {
@@ -156,6 +158,9 @@ var JiraApi = exports.JiraApi = function(protocol, host, port, username, passwor
156158
if (altBase != null) {
157159
basePath = altBase;
158160
}
161+
if (this.base) {
162+
basePath = this.base + '/' + basePath;
163+
}
159164

160165
var apiVersion = this.apiVersion;
161166
if (altApiVersion != null) {

0 commit comments

Comments
 (0)