Commit 6ff6b68 1 parent 22172ac commit 6ff6b68 Copy full SHA for 6ff6b68
File tree 3 files changed +29
-0
lines changed
3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ Changelog
11
11
- Add an optional parameter to the CLI for `send-simple ` and `send-e2e ` to allow
12
12
passing the text as an argument instead from stdin.
13
13
- Make the random padding spec compliant
14
+ - Add an optional environment variable `GATEWAY_API_URL ` to override the Gateway
15
+ API Endpoint URL
14
16
15
17
`7.0.1 `_ (2023-02-21)
16
18
---------------------
Original file line number Diff line number Diff line change @@ -67,6 +67,21 @@ the Threema gateway. Run the following command to see usage information:
67
67
68
68
$ threema-gateway --help
69
69
70
+ Gateway API Endpoint
71
+ --------------------
72
+
73
+ The default Gateway API Endpoint URL used is https://msgapi.threema.ch/.
74
+
75
+ If you are a Threema OnPrem customer or have another reason to use a different
76
+ Gateway API Endpoint, you may override the URL as follows:
77
+
78
+ .. code-block :: bash
79
+
80
+ $ export GATEWAY_API_URL=https://onprem.myinstance.tld/msgapi
81
+
82
+ Any following calls to ``threema-gateway `` will then use the supplied Gateway
83
+ API Endpoint URL.
84
+
70
85
Examples
71
86
********
72
87
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 (
53
+ 'https://msgapi.threema.ch' ,
54
+ _api_url .rstrip ('/' )
55
+ )
56
+ for key , value in Connection .urls .items ()}
45
57
46
58
47
59
class _MockConnection (AioRunMixin ):
You can’t perform that action at this time.
0 commit comments