dunglas / mercure

🪽 An open, easy, fast, reliable and battery-efficient solution for real-time communications
https://mercure.rocks
GNU Affero General Public License v3.0
3.98k stars 297 forks source link

Please add docker secrets feature support that loads env falues from files #956

Open Arkemlar opened 1 month ago

Arkemlar commented 1 month ago

Before:

    mercure:
        image: dunglas/mercure
        environment:
            MERCURE_PUBLISHER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'
            MERCURE_SUBSCRIBER_JWT_KEY: '!ChangeThisMercureHubJWTSecretKey!'

After:

    mercure:
        image: dunglas/mercure
        environment:
            MERCURE_PUBLISHER_JWT_KEY_FILE: /run/secrets/mercure_publisher_key
            MERCURE_SUBSCRIBER_JWT_KEY_FILE: /run/secrets/mercure_subscriber_key
        secrets:
            - source: mercure_publisher_key
            - source: mercure_subscriber_key

secrets:
    mercure_publisher_key:
        file: docker/secrets/mercure_publisher_key
    mercure_subscriber_key:
        file: docker/secrets/mercure_subscriber_key

Image requires entrypoint with file_env() function definition and execution - see example

Currently there is no entrypoint setting for the image, so no conflict arises as for now. The problem is container doesn't contain bash so it needs more investigetion