Commit 5e9e06a 1 parent a36e8ed commit 5e9e06a Copy full SHA for 5e9e06a
File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,18 @@ the Threema gateway. Run the following command to see usage information:
69
69
70
70
$ threema-gateway --help
71
71
72
+ Setting a different API url
73
+ ---------------------------
74
+
75
+ The default MsgApi URL points to https://msgapi.threema.ch/.
76
+
77
+ If you are a Threema OnPrem customer or have another reason
78
+ to use a different MsgApi endpoint, you may set an environment variable as follows:
79
+
80
+ .. code-block :: bash
81
+
82
+ $ GATEWAY_API_URL=https://onprem.myinstance.tld/msgapi threema-gateway ...
83
+
72
84
Examples
73
85
********
74
86
Original file line number Diff line number Diff line change 36
36
37
37
# Apply mock URL when starting CLI in debug mode
38
38
_test_port = os .environ .get ('THREEMA_TEST_API' )
39
+ _api_url = os .environ .get ('GATEWAY_API_URL' )
39
40
if _test_port is not None :
41
+ if _api_url is not None :
42
+ raise RuntimeError ('GATEWAY_API_URL cannot be set alongside THREEMA_TEST_API' )
40
43
_mock_url = 'http://{}:{}' .format ('127.0.0.1' , _test_port )
41
44
Connection .urls = {key : value .replace ('https://msgapi.threema.ch' , _mock_url )
42
45
for key , value in Connection .urls .items ()}
43
46
click .echo (('WARNING: Currently running in test mode!'
44
47
'The Threema Gateway Server will not be contacted!' ), err = True )
48
+ else :
49
+ if _api_url is not None :
50
+ if not _api_url .startswith ('https://' ):
51
+ raise RuntimeError ('GATEWAY_API_URL must begin with "https://"' )
52
+ Connection .urls = {key : value .replace ('https://msgapi.threema.ch' , _api_url .rstrip ('/' ))
53
+ for key , value in Connection .urls .items ()}
45
54
46
55
47
56
class _MockConnection (AioRunMixin ):
You can’t perform that action at this time.
0 commit comments