Skip to content

Commit 161a2f6

Browse files
committed
allow custom domains
1 parent 9cfcdb2 commit 161a2f6

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ This library does not include permissions management, and it is primarily used a
1010

1111
`pip install --upgrade staffjoy`
1212

13+
## Self-Hosted Use
14+
15+
If you are self-hosting Staffjoy on a custom domain, please pass a `url_base` to the client. It defaults to `https://suite.staffjoy.com/api/v2/"`. (Trailing slash may matter).
16+
17+
```python
18+
from Staffjoy import Client
19+
c = Client(key=YOUR_API_KEY, url_base="https://staffjoy.example.com/api/v2/")
20+
```
21+
1322
## Authentication
1423

1524
Authentication keys are currently tied to an individual user's account. To issue multiple keys, we currently suggest

staffjoy/resource.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ def __init__(self,
2626
key="",
2727
config=None,
2828
env="prod",
29+
url_base=None,
2930
data={},
3031
route={},
3132
meta={}):
@@ -34,6 +35,10 @@ def __init__(self,
3435

3536
self.config = config or config_from_env.get(env, "prod")
3637

38+
# Used for self-hosted Staffjoy users
39+
if url_base:
40+
self.config.BASE = url_base
41+
3742
# These should be overridden by child classes
3843
self.data = data # Data from the read method
3944
self.route = route # Route variables

0 commit comments

Comments
 (0)