mirror of
https://github.com/mentos1386/zdravko.git
synced 2024-11-25 08:58:50 +00:00
chore: debug
This commit is contained in:
parent
08e19be859
commit
c9a57f0d2b
2 changed files with 17 additions and 2 deletions
|
@ -8,6 +8,7 @@ import (
|
||||||
|
|
||||||
"code.tjo.space/mentos1386/zdravko/internal/config"
|
"code.tjo.space/mentos1386/zdravko/internal/config"
|
||||||
"github.com/golang-jwt/jwt/v5"
|
"github.com/golang-jwt/jwt/v5"
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
func JwtPublicKeyID(key *rsa.PublicKey) string {
|
func JwtPublicKeyID(key *rsa.PublicKey) string {
|
||||||
|
@ -16,11 +17,19 @@ func JwtPublicKeyID(key *rsa.PublicKey) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func JwtPrivateKey(c *config.Config) (*rsa.PrivateKey, error) {
|
func JwtPrivateKey(c *config.Config) (*rsa.PrivateKey, error) {
|
||||||
return jwt.ParseRSAPrivateKeyFromPEM([]byte(c.Jwt.PrivateKey))
|
key, err := jwt.ParseRSAPrivateKeyFromPEM([]byte(c.Jwt.PrivateKey))
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "failed to parse private key")
|
||||||
|
}
|
||||||
|
return key, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func JwtPublicKey(c *config.Config) (*rsa.PublicKey, error) {
|
func JwtPublicKey(c *config.Config) (*rsa.PublicKey, error) {
|
||||||
return jwt.ParseRSAPublicKeyFromPEM([]byte(c.Jwt.PublicKey))
|
key, err := jwt.ParseRSAPublicKeyFromPEM([]byte(c.Jwt.PublicKey))
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Wrap(err, "failed to parse public key")
|
||||||
|
}
|
||||||
|
return key, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ref: https://docs.temporal.io/self-hosted-guide/security#authorization
|
// Ref: https://docs.temporal.io/self-hosted-guide/security#authorization
|
||||||
|
|
6
justfile
6
justfile
|
@ -49,6 +49,12 @@ generate-jwt-key:
|
||||||
deploy:
|
deploy:
|
||||||
fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}}
|
fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}}
|
||||||
|
|
||||||
|
|
||||||
|
deploy-set-jwt-key-secrets:
|
||||||
|
@fly secrets set -c deploy/fly.toml \
|
||||||
|
"JWT_PRIVATE_KEY={{JWT_PRIVATE_KEY}}" \
|
||||||
|
"JWT_PUBLIC_KEY={{JWT_PUBLIC_KEY}}"
|
||||||
|
|
||||||
# Start devbox shell
|
# Start devbox shell
|
||||||
shell:
|
shell:
|
||||||
devbox shell
|
devbox shell
|
||||||
|
|
Loading…
Reference in a new issue