Skip to content

Commit a0b2cdf

Browse files
authored
Updates for temporal CLI over tctl and temporal dev-server (#131)
1 parent 35b476d commit a0b2cdf

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

Diff for: encryption/README.md

+9-12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This sample shows how to make an encryption codec for end-to-end encryption. It
44
samples [in TypeScript](https://github.com/temporalio/samples-typescript/tree/main/encryption) and
55
[in Go](https://github.com/temporalio/samples-go/tree/main/encryption).
66

7+
78
For this sample, the optional `encryption` dependency group must be included. To include, run:
89

910
poetry install --with encryption
@@ -17,38 +18,34 @@ This will start the worker. Then, in another terminal, run the following to exec
1718

1819
poetry run python starter.py
1920

20-
The workflow should complete with the hello result. To view the workflow, use [tctl](https://docs.temporal.io/tctl-v1/):
21+
The workflow should complete with the hello result. To view the workflow, use [temporal](https://docs.temporal.io/cli):
2122

22-
tctl workflow show --workflow_id encryption-workflow-id
23+
temporal workflow show --workflow-id encryption-workflow-id
2324

24-
Note how the input/result look like (with wrapping removed):
25+
Note how the result looks like (with wrapping removed):
2526

2627
```
27-
Input:[encoding binary/encrypted: payload encoding is not supported]
28-
...
29-
Result:[encoding binary/encrypted: payload encoding is not supported]
28+
Output:[encoding binary/encrypted: payload encoding is not supported]
3029
```
3130

32-
This is because the data is encrypted and not visible. To make data visible to external Temporal tools like `tctl` and
31+
This is because the data is encrypted and not visible. To make data visible to external Temporal tools like `temporal` and
3332
the UI, start a codec server in another terminal:
3433

3534
poetry run python codec_server.py
3635

37-
Now with that running, run `tctl` again with the codec endpoint:
36+
Now with that running, run `temporal` again with the codec endpoint:
3837

39-
tctl --codec_endpoint http://localhost:8081 workflow show --workflow_id encryption-workflow-id
38+
temporal workflow show --workflow-id encryption-workflow-id --codec-endpoint http://localhost:8081
4039

4140
Notice now the output has the unencrypted values:
4241

4342
```
44-
Input:["Temporal"]
45-
...
4643
Result:["Hello, Temporal"]
4744
```
4845

4946
This decryption did not leave the local machine here.
5047

5148
Same case with the web UI. If you go to the web UI, you'll only see encrypted input/results. But, assuming your web UI
52-
is at `http://localhost:8080`, if you set the "Remote Codec Endpoint" in the web UI to `http://localhost:8081` you can
49+
is at `http://localhost:8233` (this is the default for the local dev server), if you set the "Remote Codec Endpoint" in the web UI to `http://localhost:8081` you can
5350
then see the unencrypted results. This is possible because CORS settings in the codec server allow the browser to access
5451
the codec server directly over localhost. They can be changed to suit Temporal cloud web UI instead if necessary.

Diff for: encryption/codec_server.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ def build_codec_server() -> web.Application:
1212
# Cors handler
1313
async def cors_options(req: web.Request) -> web.Response:
1414
resp = web.Response()
15-
if req.headers.get(hdrs.ORIGIN) == "http://localhost:8080":
16-
resp.headers[hdrs.ACCESS_CONTROL_ALLOW_ORIGIN] = "http://localhost:8080"
15+
if req.headers.get(hdrs.ORIGIN) == "http://localhost:8233":
16+
resp.headers[hdrs.ACCESS_CONTROL_ALLOW_ORIGIN] = "http://localhost:8233"
1717
resp.headers[hdrs.ACCESS_CONTROL_ALLOW_METHODS] = "POST"
1818
resp.headers[hdrs.ACCESS_CONTROL_ALLOW_HEADERS] = "content-type,x-namespace"
1919
return resp

0 commit comments

Comments
 (0)