Benny's Shopware Notebook
  • Introduction
    • How to Get in Touch
  • ddev for Shopware
    • Less than 5 Minutes Install with ddev and Symfony Flex
    • Storefront and Admin Watchers with ddev
    • Message Queue Setup with ddev
    • Contribute with ddev
    • Performance Tweaks
    • RabbitMQ with ddev
    • phpstan pro with ddev
    • Fetch Media from Production or Staging Server
  • Hosting
    • Setting up a Cloud Server with ddev
    • How to Trouble-shoot and Evaluate Environment Variables
    • Media URLs Out Of Sync between Servers
    • RabbitMQ
    • Running Shopware CE with PaaS
    • SFTP-Users
    • Basic-Auth for Shopware 6 with nginx
    • How to Avoid Failed Systemd Units
    • JWT-Secrets as Environment Variables
  • Deployment
    • Close-to-Zero Downtime Deployment
    • Docker-Images for Deployment with Gitlab-Runners
    • PHP Cache Related Issues
  • Development
    • Patching the Core
    • How to Discover Available Updates?
    • Local Testing of Shopware Commercial Features
  • Administration
  • Database
  • Migration
    • Side Effects
Powered by GitBook
On this page

Was this helpful?

  1. Hosting

JWT-Secrets as Environment Variables

When using Shopware 6.6 in a dockerized or cluster setup, you may want to use env vars in lieu of files for your JWT keys. This is how convert your keys.

In your shopware.yaml (or any other valid configuration file), create or amend the following entry:

shopware:
    api:                                                                                                               
        jwt_key:                                                                                                       
            private_key_path: '%env(base64:JWT_PRIVATE_KEY)%'                                                          
            public_key_path: '%env(base64:JWT_PUBLIC_KEY)%'

The easiest way to generate JWT secrets is using shopware-cli with the following command:

shopware-cli project generate-jwt --env

If you have already generated your file-based JWT keys, use these commands to create the base64 equivalent to be specified in .env:

cat shopware/config/jwt/private.pem | base64 | tr -d '\n'
cat shopware/config/jwt/public.pem | base64 | tr -d '\n'

and paste the corresponding results as values for JWT_PRIVATE_KEY and JWT_PUBLIC_KEY, respectively, in your .env.local.

PreviousHow to Avoid Failed Systemd UnitsNextDeployment

Last updated 8 months ago

Was this helpful?