add keygen facility
All checks were successful
Github Actions Demo / Explore-Gitea-Actions (push) Successful in 5s

This commit is contained in:
James Andariese 2024-03-02 15:13:51 -06:00
parent df736e0578
commit 9032f5a132
2 changed files with 31 additions and 2 deletions

View File

@ -11,6 +11,7 @@ RUN go build
FROM alpine:3.19 FROM alpine:3.19
COPY --from=build /ipfs-key/ipfs-key /bin/ipfs-key COPY --from=build /ipfs-key/ipfs-key /bin/ipfs-key
ADD entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/bin/ipfs-key"] ENTRYPOINT ["/entrypoint.sh"]
CMD [] CMD ["-type", "ed25519"]

28
entrypoint.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
cd /root
/bin/ipfs-key "$@" 2> /root/keygen.stderr 1> peer.key
awk '/^ID for generated key:/ {print $5}' < keygen.stderr > peer.id
xxd -p -l 32 -c 32 /dev/random > cluster.key
cat << EOF
---
apiVersion: v1
kind: ConfigMap
metadata:
name: ipfs-config
data:
bootstrap-peer-id: |-
$(cat peer.id)
---
apiVersion: v1
kind: Secret
metadata:
name: ipfs-secrets
data:
cluster-secret: |-
$(base64 -w 0 cluster.key)
bootstrap-peer-private-key: |-
$(base64 -w 0 peer.key)
EOF