worker: Make BasePath configurable
This commit is contained in:
parent
6ce20a9ef6
commit
ce7ac9a756
11 changed files with 106 additions and 25 deletions
|
|
@ -55,12 +55,14 @@ type job struct {
|
|||
dynamicArgs []json.RawMessage
|
||||
}
|
||||
|
||||
func NewClient(baseURL string, conf *tls.Config, offlineToken, oAuthURL *string) (*Client, error) {
|
||||
func NewClient(baseURL string, conf *tls.Config, offlineToken, oAuthURL *string, basePath string) (*Client, error) {
|
||||
server, err := url.Parse(baseURL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
api.BasePath = basePath
|
||||
|
||||
server, err = server.Parse(api.BasePath + "/")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
@ -76,12 +78,14 @@ func NewClient(baseURL string, conf *tls.Config, offlineToken, oAuthURL *string)
|
|||
return &Client{server, requester, offlineToken, oAuthURL, nil, nil, &sync.Mutex{}}, nil
|
||||
}
|
||||
|
||||
func NewClientUnix(path string) *Client {
|
||||
func NewClientUnix(path string, basePath string) *Client {
|
||||
server, err := url.Parse("http://localhost/")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
api.BasePath = basePath
|
||||
|
||||
server, err = server.Parse(api.BasePath + "/")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue