Skip to content

Commit 7c3d0c1

Browse files
committed
Updates: ensure docker dependencies are clear and notes about other container toolsets
1 parent 831bada commit 7c3d0c1

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

rest/tls/README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# TLS
22

33

4-
For more inforamtion on using TLS in your REST apis and other services [see our documentation](https://www.ibm.com/docs/en/api-connect-graphql/saas?topic=directives-directive-rest#tls-string__title__1).
4+
For more information on using TLS in your REST apis and other services [see our documentation](https://www.ibm.com/docs/en/api-connect-graphql/saas?topic=directives-directive-rest#tls-string__title__1).
55

66
[Environment](https://www.ibm.com/docs/en/api-connect-graphql/saas?topic=environment-tls-configuration-properties). Check that the revision is newer than : 2025-11-18.
77

88
## Using `@rest(tls:)`
99

10-
This examples demonstrates a number of StepZen capabilities:
10+
This examples demonstrates a number of API Connect for GraphQL capabilities:
1111
- Use of `@rest(tls:)`
1212
- stepzen service
1313
- Simple ecmascript capability for reshaping data.
@@ -20,7 +20,7 @@ that refers to a configuration in the `config.yaml`
2020

2121
When the tls entry is given the name of a configuration entry, you can provide
2222
- `ca` - the server `ca` or `ca` chain (starting with the leaf certificate)
23-
- 'cert` - the client certificate
23+
- `cert` - the client certificate
2424
- `key` - the client certifcate key
2525
The data should be in PEM format.
2626

@@ -49,18 +49,21 @@ Two safe approaches are to set the environment variables from secrets or to have
4949

5050
See tricks below for some possible hurdles.
5151

52-
5352
### Running a test
5453

5554
Testing mTLS or self-signed certificates locally is best done using local API Connect for GraphQL.
5655
In the following, we'll generate the certificates using openssl, use openssl to for trivialself-signed cert servers
5756
and use the stepzen cli local service mode as a client.
5857

58+
Note: if you are not using Docker, see Tricks and hints/Container tools.
59+
5960
#### Steps
6061
```
6162
stepzen service start
6263
stepzen login --config ~/.stepzen/stepzen-config.local.yaml
6364
(cd tests; make env)
65+
# WARNING: if you are not using Docker, please see
66+
# Tricks and hints/Container tools
6467
stepzen deploy
6568
6669
# start trivial local TLS server using openssl
@@ -77,7 +80,17 @@ stepzen service stop
7780
```
7881

7982

80-
### Tricks
83+
## Tricks and hints
84+
85+
### Container tools
86+
87+
API Connect for GraphQL local services runs inside of a container using Docker, Podman, or other container runtime toolset. Each of these have a slightly different method whereby containers can access the host machine's localhost. The details of these are varied depending upon the actual toolset.
88+
89+
By default, `rest_self` uses `host.docker.internal` which works in most modern Docker environments.
90+
91+
For Podman, you may need to change this to `host.containers.internal` or `localhost` depending on your podman defaults. You may also need to modify your podman default configuration to allow for such access.
92+
93+
### env variables
8194

8295
You can set `STEPZEN_*` env variables in .env or using export.
8396

rest/tls/index.graphql

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
schema @sdl(files: ["tls.graphql"]) {
22
query: Query
33
}
4-

rest/tls/tls.graphql

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@ type Query {
66
rest_self: JSON
77
@rest(
88
endpoint: "https://host.docker.internal:8443/"
9+
# alternate endpoint settings for different container toolsets
10+
# endpoint: "https://localhost:8443/"
11+
# endpoint: "https://host.rancher-desktop.internal:8443/"
912
tls: "selfsign"
1013
ecmascript: """
11-
function transformREST(s) { return JSON.stringify({data100: s.length>100, accept_8443: s.includes("-accept 8443")})}
14+
function transformREST(s) {
15+
return JSON.stringify(
16+
{data100: s.length>100,
17+
accept_8443: s.includes("-accept 8443")
18+
})
19+
}
1220
"""
1321
)
1422
}

0 commit comments

Comments
 (0)