Skip to content

Commit 15ed8e2

Browse files
committed
adding docker based generator script
1 parent 2fa6e9d commit 15ed8e2

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,36 @@ Docker image is publicly available so you can run it on your own infrastructure:
5858
```bash
5959
docker run --rm -p 3000:3000 kyberneees/jwt-keys-generator-api:latest
6060
```
61+
Then:
62+
```bash
63+
curl -s http://localhost:3000/api/generate/ES512 | jq "."
64+
```
65+
66+
## Keys Generator Script
67+
Alternatively, you can use the following script which also uses Docker:
68+
```bash
69+
#!/bin/bash
70+
set -e
71+
72+
ALGO="${1:-RS256}"
73+
echo "Algorihtm: $ALGO"
74+
75+
echo "> launching container..."
76+
docker run -d -p 3000:3000 --name jwt-keys kyberneees/jwt-keys-generator-api > /dev/null
77+
sleep 1
78+
79+
echo "> generating keys..."
80+
curl -s http://localhost:3000/api/generate/$ALGO | jq "."
81+
82+
echo "> terminating container..."
83+
docker rm --force jwt-keys > /dev/null
84+
```
85+
> NOTE: Please note that only the `algorithm` argument is supported in the script!
86+
87+
Usage:
88+
```bash
89+
sh gen-keys.sh ES512
90+
```
6191

6292
# LICENSE
6393

scripts/gen-keys.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
ALGO="${1:-RS256}"
5+
echo "Algorihtm: $ALGO"
6+
7+
echo "> launching container..."
8+
docker run -d -p 3000:3000 --name jwt-keys kyberneees/jwt-keys-generator-api > /dev/null
9+
sleep 1
10+
11+
echo "> generating keys..."
12+
curl -s http://localhost:3000/api/generate/$ALGO | jq "."
13+
14+
echo "> terminating container..."
15+
docker rm --force jwt-keys > /dev/null

0 commit comments

Comments
 (0)